Update app.py
Browse files
app.py
CHANGED
|
@@ -135,7 +135,7 @@ def run_showui(image, query):
|
|
| 135 |
|
| 136 |
# Draw the point on the image
|
| 137 |
result_image = draw_point(image_path, click_xy, radius=10)
|
| 138 |
-
return result_image, str(click_xy), session_id
|
| 139 |
|
| 140 |
# Modify the record_vote function
|
| 141 |
def record_vote(vote_type, image_path, query, action_generated, session_id):
|
|
@@ -259,8 +259,8 @@ def build_demo(embed_mode, concurrency_count=1):
|
|
| 259 |
raise ValueError("No image provided. Please upload an image before submitting.")
|
| 260 |
|
| 261 |
# Generate consistent image path and store it in the state
|
| 262 |
-
result_image, click_coords, session_id = run_showui(image, query)
|
| 263 |
-
return result_image, click_coords, session_id
|
| 264 |
|
| 265 |
def on_image_upload(image):
|
| 266 |
"""Generate a new session ID when a new image is uploaded."""
|
|
@@ -281,20 +281,20 @@ def build_demo(embed_mode, concurrency_count=1):
|
|
| 281 |
submit_btn.click(
|
| 282 |
on_submit,
|
| 283 |
[imagebox, textbox],
|
| 284 |
-
[output_img, output_coords, state_session_id],
|
| 285 |
)
|
| 286 |
|
| 287 |
clear_btn.click(
|
| 288 |
lambda: (None, None, None, None, None),
|
| 289 |
inputs=None,
|
| 290 |
-
outputs=[imagebox, textbox, output_img, output_coords, state_session_id], # Clear all outputs
|
| 291 |
queue=False
|
| 292 |
)
|
| 293 |
|
| 294 |
regenerate_btn.click(
|
| 295 |
lambda image, query, state_image_path: run_showui(image, query),
|
| 296 |
[imagebox, textbox, state_image_path],
|
| 297 |
-
[output_img, output_coords],
|
| 298 |
)
|
| 299 |
|
| 300 |
# Record vote actions without feedback messages
|
|
|
|
| 135 |
|
| 136 |
# Draw the point on the image
|
| 137 |
result_image = draw_point(image_path, click_xy, radius=10)
|
| 138 |
+
return result_image, str(click_xy), image_path, session_id
|
| 139 |
|
| 140 |
# Modify the record_vote function
|
| 141 |
def record_vote(vote_type, image_path, query, action_generated, session_id):
|
|
|
|
| 259 |
raise ValueError("No image provided. Please upload an image before submitting.")
|
| 260 |
|
| 261 |
# Generate consistent image path and store it in the state
|
| 262 |
+
result_image, click_coords, image_path, session_id = run_showui(image, query)
|
| 263 |
+
return result_image, click_coords, image_path, session_id
|
| 264 |
|
| 265 |
def on_image_upload(image):
|
| 266 |
"""Generate a new session ID when a new image is uploaded."""
|
|
|
|
| 281 |
submit_btn.click(
|
| 282 |
on_submit,
|
| 283 |
[imagebox, textbox],
|
| 284 |
+
[output_img, output_coords, state_image_path, state_session_id],
|
| 285 |
)
|
| 286 |
|
| 287 |
clear_btn.click(
|
| 288 |
lambda: (None, None, None, None, None),
|
| 289 |
inputs=None,
|
| 290 |
+
outputs=[imagebox, textbox, output_img, output_coords, state_image_path, state_session_id], # Clear all outputs
|
| 291 |
queue=False
|
| 292 |
)
|
| 293 |
|
| 294 |
regenerate_btn.click(
|
| 295 |
lambda image, query, state_image_path: run_showui(image, query),
|
| 296 |
[imagebox, textbox, state_image_path],
|
| 297 |
+
[output_img, output_coords, state_image_path],
|
| 298 |
)
|
| 299 |
|
| 300 |
# Record vote actions without feedback messages
|