Browse Source

Merge pull request #152 from alexandrevicenzi/timeout

Add timeout for image download
Jason Antic 6 năm trước cách đây
mục cha
commit
0baf509b43
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  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