Explorar o código

Merge pull request #152 from alexandrevicenzi/timeout

Add timeout for image download
Jason Antic %!s(int64=6) %!d(string=hai) anos
pai
achega
0baf509b43
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      deoldify/visualize.py

+ 1 - 1
deoldify/visualize.py

@@ -32,7 +32,7 @@ class ModelImageVisualizer():
         return PIL.Image.open(path).convert('RGB')
 
     def _get_image_from_url(self, url:str)->Image:
-        response = requests.get(url)
+        response = requests.get(url, timeout=30)
         img = PIL.Image.open(BytesIO(response.content)).convert('RGB')
         return img