Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -197,17 +197,16 @@ def create_interface():
|
|
197 |
|
198 |
# Add status message and debug output
|
199 |
status_msg = gr.Markdown(label="Status")
|
200 |
-
debug_output = gr.Textbox(label="Debug Info", interactive=False)
|
201 |
|
202 |
# Event handlers
|
203 |
def handle_image_upload(bbox_data):
|
204 |
try:
|
205 |
if not bbox_data or not isinstance(bbox_data, tuple):
|
206 |
-
return None
|
207 |
|
208 |
image_path, annotations = bbox_data
|
209 |
if not image_path:
|
210 |
-
return None
|
211 |
|
212 |
logger.info(f"Handling upload for: {image_path}")
|
213 |
resized_path = annotation_mgr.process_upload(image_path)
|
@@ -216,11 +215,11 @@ def create_interface():
|
|
216 |
debug_msg = f"Processed image path: {resized_path}"
|
217 |
logger.info(debug_msg)
|
218 |
# Return the resized path and keep any existing annotations
|
219 |
-
return (resized_path, annotations)
|
220 |
else:
|
221 |
error_msg = "Failed to process image"
|
222 |
logger.error(error_msg)
|
223 |
-
return None
|
224 |
|
225 |
except Exception as e:
|
226 |
error_msg = f"Error in upload handler: {str(e)}"
|
@@ -231,7 +230,7 @@ def create_interface():
|
|
231 |
bbox_input.upload(
|
232 |
fn=handle_image_upload,
|
233 |
inputs=[bbox_input],
|
234 |
-
outputs=[bbox_input,
|
235 |
)
|
236 |
|
237 |
save_btn.click(
|
|
|
197 |
|
198 |
# Add status message and debug output
|
199 |
status_msg = gr.Markdown(label="Status")
|
|
|
200 |
|
201 |
# Event handlers
|
202 |
def handle_image_upload(bbox_data):
|
203 |
try:
|
204 |
if not bbox_data or not isinstance(bbox_data, tuple):
|
205 |
+
return None
|
206 |
|
207 |
image_path, annotations = bbox_data
|
208 |
if not image_path:
|
209 |
+
return None
|
210 |
|
211 |
logger.info(f"Handling upload for: {image_path}")
|
212 |
resized_path = annotation_mgr.process_upload(image_path)
|
|
|
215 |
debug_msg = f"Processed image path: {resized_path}"
|
216 |
logger.info(debug_msg)
|
217 |
# Return the resized path and keep any existing annotations
|
218 |
+
return (resized_path, annotations)
|
219 |
else:
|
220 |
error_msg = "Failed to process image"
|
221 |
logger.error(error_msg)
|
222 |
+
return None
|
223 |
|
224 |
except Exception as e:
|
225 |
error_msg = f"Error in upload handler: {str(e)}"
|
|
|
230 |
bbox_input.upload(
|
231 |
fn=handle_image_upload,
|
232 |
inputs=[bbox_input],
|
233 |
+
outputs=[bbox_input, status_msg]
|
234 |
)
|
235 |
|
236 |
save_btn.click(
|