rphrp1985 commited on
Commit
0c2a731
·
verified ·
1 Parent(s): 2629137

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -4
app.py CHANGED
@@ -60,10 +60,23 @@ def bot_streaming(message, history, max_new_tokens=250):
60
 
61
 
62
 
63
- for url in files:
64
- response = requests.get(url)
65
- img = Image.open(BytesIO(response.content)).convert("RGB")
66
- images.append(img)
 
 
 
 
 
 
 
 
 
 
 
 
 
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)