Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -60,10 +60,23 @@ def bot_streaming(message, history, max_new_tokens=250):
|
|
60 |
|
61 |
|
62 |
|
63 |
-
for
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
|
69 |
print("\n\nfinal messages ", messages)
|
|
|
60 |
|
61 |
|
62 |
|
63 |
+
for x in messages:
|
64 |
+
try:
|
65 |
+
if x['content'][1]['type']=='image':
|
66 |
+
url = x['content'][1]['url']
|
67 |
+
response = requests.get(url)
|
68 |
+
img = Image.open(BytesIO(response.content)).convert("RGB")
|
69 |
+
images.append(img)
|
70 |
+
except :
|
71 |
+
try:
|
72 |
+
if x['content'][0]['type']=='image':
|
73 |
+
url = x['content'][1]['url']
|
74 |
+
response = requests.get(url)
|
75 |
+
img = Image.open(BytesIO(response.content)).convert("RGB")
|
76 |
+
images.append(img)
|
77 |
+
|
78 |
+
except:
|
79 |
+
pass
|
80 |
|
81 |
|
82 |
print("\n\nfinal messages ", messages)
|