Эх сурвалжийг харах

Merge pull request #152 from alexandrevicenzi/timeout

Add timeout for image download
Jason Antic 6 жил өмнө
parent
commit
0baf509b43
1 өөрчлөгдсөн 1 нэмэгдсэн , 1 устгасан
  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