ashu1069 commited on
Commit
6153417
·
1 Parent(s): f2658b4
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -224,7 +224,6 @@ class VideoAnnotator:
224
  # --- End Edit ---
225
 
226
  def create_interface():
227
- # Move the VideoAnnotator creation inside a function that will be called for each session
228
  def get_session_annotator():
229
  annotator = VideoAnnotator()
230
  success = annotator.load_videos_from_hf()
@@ -279,11 +278,15 @@ def create_interface():
279
 
280
  save_btn = gr.Button("Save Annotations", variant="primary")
281
 
282
- # Add this after all components are defined but before the event handlers
283
  demo.load(
284
- fn=lambda annotator: annotator.get_current_video(),
 
 
 
 
285
  inputs=[annotator_state],
286
- outputs=video_player
287
  )
288
 
289
  # Modify the event handlers to use the session-specific annotator
 
224
  # --- End Edit ---
225
 
226
  def create_interface():
 
227
  def get_session_annotator():
228
  annotator = VideoAnnotator()
229
  success = annotator.load_videos_from_hf()
 
278
 
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
+ fn=lambda annotator: (
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