Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -106,9 +106,10 @@ def process_input(text=None, file=None, task_history=None):
|
|
| 106 |
|
| 107 |
if "<box>" in response and image_path:
|
| 108 |
image_with_boxes = draw_boxes(image_path, response)
|
| 109 |
-
|
| 110 |
-
image_with_boxes.save(
|
| 111 |
-
|
|
|
|
| 112 |
else:
|
| 113 |
cleaned_response = clean_response(response)
|
| 114 |
return [("bot", cleaned_response)], task_history
|
|
|
|
| 106 |
|
| 107 |
if "<box>" in response and image_path:
|
| 108 |
image_with_boxes = draw_boxes(image_path, response)
|
| 109 |
+
buffered = BytesIO()
|
| 110 |
+
image_with_boxes.save(buffered, format="PNG")
|
| 111 |
+
img_str = buffered.getvalue()
|
| 112 |
+
return [("bot", response, "data:image/png;base64," + base64.b64encode(img_str).decode())], task_history
|
| 113 |
else:
|
| 114 |
cleaned_response = clean_response(response)
|
| 115 |
return [("bot", cleaned_response)], task_history
|