xj
commited on
Commit
•
ea05f46
1
Parent(s):
f7a3ffd
fix: 修改了最后找到物品后的展示.
Browse files- gradio_app.py +3 -2
gradio_app.py
CHANGED
@@ -123,13 +123,14 @@ def get_gradio_demo(model, tokenizer, image_processor) -> gr.Interface:
|
|
123 |
except StopIteration:
|
124 |
yield history + [(message, '')]
|
125 |
for response in generator:
|
126 |
-
chatbot = history + [(message, response)]
|
127 |
if "region:" in response:
|
128 |
bboxes = model.utils.sbbox_to_bbox(response)
|
129 |
if len(bboxes):
|
130 |
with tempfile.NamedTemporaryFile(suffix=".jpg", delete=False) as f:
|
131 |
model.utils.show_mask(image, bboxes).save(f)
|
132 |
-
chatbot
|
|
|
|
|
133 |
yield chatbot
|
134 |
|
135 |
|
|
|
123 |
except StopIteration:
|
124 |
yield history + [(message, '')]
|
125 |
for response in generator:
|
|
|
126 |
if "region:" in response:
|
127 |
bboxes = model.utils.sbbox_to_bbox(response)
|
128 |
if len(bboxes):
|
129 |
with tempfile.NamedTemporaryFile(suffix=".jpg", delete=False) as f:
|
130 |
model.utils.show_mask(image, bboxes).save(f)
|
131 |
+
chatbot = history + [(message, "OK, I see."), (None, (f.name,))]
|
132 |
+
else:
|
133 |
+
chatbot = history + [(message, response)]
|
134 |
yield chatbot
|
135 |
|
136 |
|