Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,10 +30,7 @@ def chat_with_image(message, image, history):
|
|
| 30 |
if encoded_image:
|
| 31 |
messages.append({
|
| 32 |
"role": "user",
|
| 33 |
-
"content": [
|
| 34 |
-
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{encoded_image}"}},
|
| 35 |
-
{"type": "text", "text": "What's in this image?"}
|
| 36 |
-
]
|
| 37 |
})
|
| 38 |
else:
|
| 39 |
messages.append({"role": "user", "content": "I tried to upload an image, but there was an error."})
|
|
@@ -48,10 +45,7 @@ def chat_with_image(message, image, history):
|
|
| 48 |
if encoded_image:
|
| 49 |
messages.append({
|
| 50 |
"role": "user",
|
| 51 |
-
"content": [
|
| 52 |
-
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{encoded_image}"}},
|
| 53 |
-
{"type": "text", "text": message or "What's in this image?"}
|
| 54 |
-
]
|
| 55 |
})
|
| 56 |
else:
|
| 57 |
messages.append({"role": "user", "content": "I tried to upload an image, but there was an error."})
|
|
|
|
| 30 |
if encoded_image:
|
| 31 |
messages.append({
|
| 32 |
"role": "user",
|
| 33 |
+
"content": f"[IMAGE]{encoded_image}[/IMAGE]\nWhat's in this image?"
|
|
|
|
|
|
|
|
|
|
| 34 |
})
|
| 35 |
else:
|
| 36 |
messages.append({"role": "user", "content": "I tried to upload an image, but there was an error."})
|
|
|
|
| 45 |
if encoded_image:
|
| 46 |
messages.append({
|
| 47 |
"role": "user",
|
| 48 |
+
"content": f"[IMAGE]{encoded_image}[/IMAGE]\n{message or 'What's in this image?'}"
|
|
|
|
|
|
|
|
|
|
| 49 |
})
|
| 50 |
else:
|
| 51 |
messages.append({"role": "user", "content": "I tried to upload an image, but there was an error."})
|