Spaces:
Sleeping
Sleeping
updates
Browse files
app.py
CHANGED
@@ -233,7 +233,7 @@ def create_interface():
|
|
233 |
|
234 |
with gr.Blocks() as demo:
|
235 |
# Create a state variable to store the session-specific annotator
|
236 |
-
annotator_state = gr.State(get_session_annotator)
|
237 |
|
238 |
gr.Markdown("# Cricket Video Annotation Tool")
|
239 |
|
@@ -279,15 +279,16 @@ def create_interface():
|
|
279 |
save_btn = gr.Button("Save Annotations", variant="primary")
|
280 |
|
281 |
# Modify the load event handler to properly initialize and return all outputs
|
282 |
-
demo.load(
|
283 |
-
|
|
|
|
|
|
|
|
|
284 |
annotator.get_current_video(), # video player
|
285 |
*[None] * len(ANNOTATION_CATEGORIES), # annotation components
|
286 |
"" # status display
|
287 |
-
)
|
288 |
-
inputs=[annotator_state],
|
289 |
-
outputs=[video_player] + annotation_components + [status_display]
|
290 |
-
)
|
291 |
|
292 |
# Modify the event handlers to use the session-specific annotator
|
293 |
save_btn.click(
|
|
|
233 |
|
234 |
with gr.Blocks() as demo:
|
235 |
# Create a state variable to store the session-specific annotator
|
236 |
+
annotator_state = gr.State(value=get_session_annotator()) # Initialize with the instance
|
237 |
|
238 |
gr.Markdown("# Cricket Video Annotation Tool")
|
239 |
|
|
|
279 |
save_btn = gr.Button("Save Annotations", variant="primary")
|
280 |
|
281 |
# Modify the load event handler to properly initialize and return all outputs
|
282 |
+
@demo.load(
|
283 |
+
outputs=[video_player] + annotation_components + [status_display]
|
284 |
+
)
|
285 |
+
def on_load():
|
286 |
+
annotator = get_session_annotator() # Create a fresh instance
|
287 |
+
return (
|
288 |
annotator.get_current_video(), # video player
|
289 |
*[None] * len(ANNOTATION_CATEGORIES), # annotation components
|
290 |
"" # status display
|
291 |
+
)
|
|
|
|
|
|
|
292 |
|
293 |
# Modify the event handlers to use the session-specific annotator
|
294 |
save_btn.click(
|