Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -211,6 +211,8 @@ def localized_query(img, x, y, question):
|
|
| 211 |
yield "", {"text": "", "entities": []}, gr.update(visible=False, value=None)
|
| 212 |
return
|
| 213 |
|
|
|
|
|
|
|
| 214 |
w, h = img.size
|
| 215 |
x, y = x * w, y * h
|
| 216 |
img_clone = img.copy()
|
|
@@ -221,7 +223,7 @@ def localized_query(img, x, y, question):
|
|
| 221 |
outline="blue",
|
| 222 |
)
|
| 223 |
|
| 224 |
-
yield
|
| 225 |
|
| 226 |
|
| 227 |
js = ""
|
|
|
|
| 211 |
yield "", {"text": "", "entities": []}, gr.update(visible=False, value=None)
|
| 212 |
return
|
| 213 |
|
| 214 |
+
answer = moondream.query(img, prompt, spatial_refs=[(x, y)])["answer"]
|
| 215 |
+
|
| 216 |
w, h = img.size
|
| 217 |
x, y = x * w, y * h
|
| 218 |
img_clone = img.copy()
|
|
|
|
| 223 |
outline="blue",
|
| 224 |
)
|
| 225 |
|
| 226 |
+
yield answer, {"text": "", "entities": []}, gr.update(visible=True, value=img_clone)
|
| 227 |
|
| 228 |
|
| 229 |
js = ""
|