Spaces:
Runtime error
Runtime error
VictorSanh
commited on
Commit
•
7036801
1
Parent(s):
13f2998
fix 403 with headers in requests
Browse files- app_dialogue.py +2 -1
app_dialogue.py
CHANGED
@@ -82,10 +82,11 @@ def load_tokenizer_model(model_name):
|
|
82 |
|
83 |
|
84 |
def fetch_images(url_images):
|
|
|
85 |
images = []
|
86 |
for url in url_images:
|
87 |
if isinstance(url, str):
|
88 |
-
images.append(Image.open(BytesIO(requests.get(url, stream=True).content)))
|
89 |
else:
|
90 |
images.append(url)
|
91 |
return images
|
|
|
82 |
|
83 |
|
84 |
def fetch_images(url_images):
|
85 |
+
headers={"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"}
|
86 |
images = []
|
87 |
for url in url_images:
|
88 |
if isinstance(url, str):
|
89 |
+
images.append(Image.open(BytesIO(requests.get(url, stream=True, headers=headers).content)))
|
90 |
else:
|
91 |
images.append(url)
|
92 |
return images
|