mastefan commited on
Commit
cde7881
·
verified ·
1 Parent(s): 37f607b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -35
app.py CHANGED
@@ -70,7 +70,7 @@ AG_ZIP_NAME = os.getenv("AG_ZIP_NAME", "autogluon_predictor_dir.zip")
70
 
71
  # Processing parameters
72
  FRAME_SKIP = int(os.getenv("FRAME_SKIP", "2")) # process every Nth frame
73
- KEEP_CONF = float(os.getenv("KEEP_CONF", "0.85"))# YOLO conf to keep color inside bbox
74
  YOLO_CONF = float(os.getenv("YOLO_CONF", "0.25"))
75
  YOLO_IOU = float(os.getenv("YOLO_IOU", "0.50"))
76
  MIN_SEP_S = float(os.getenv("MIN_SEP_S", "1.2")) # min gap between events (s)
@@ -577,40 +577,14 @@ with gr.Blocks(css=CSS, title="Fencing Scoreboard Detector") as demo:
577
  visible=False
578
  )
579
 
580
- def wrapped_run(video_file):
581
  if not video_file:
582
- yield gr.update(value=[], visible=False), "Please upload a video file.", gr.update(value=_make_progress_bar(0), visible=False)
583
- return
584
-
585
- # Start looping animation
586
- progress_iter = looping_progress()
587
-
588
- # Run pipeline in background, but yield progress until it finishes
589
- import threading
590
-
591
- result = {}
592
-
593
- def run_pipeline():
594
- clips, status_msg = extract_score_clips(video_file, debug=False)
595
- result["clips"] = clips
596
- result["status"] = status_msg
597
-
598
- t = threading.Thread(target=run_pipeline)
599
- t.start()
600
-
601
- while t.is_alive():
602
- yield gr.update(value=[], visible=False), "Processing...", next(progress_iter)
603
-
604
- # When pipeline is done → final bar at 100% + output
605
- clips, status_msg = result["clips"], result["status"]
606
- final_bar = _make_progress_bar(100, "✅ Done")
607
- yield gr.update(value=clips, visible=True), status_msg, final_bar
608
-
609
- run_btn.click(
610
- fn=wrapped_run,
611
- inputs=in_video,
612
- outputs=[gallery, status, progress_html],
613
- )
614
 
615
  if __name__ == "__main__":
616
- demo.launch(debug=True)
 
 
70
 
71
  # Processing parameters
72
  FRAME_SKIP = int(os.getenv("FRAME_SKIP", "2")) # process every Nth frame
73
+ KEEP_CONF = float(os.getenv("KEEP_CONF", "0.70"))# YOLO conf to keep color inside bbox
74
  YOLO_CONF = float(os.getenv("YOLO_CONF", "0.25"))
75
  YOLO_IOU = float(os.getenv("YOLO_IOU", "0.50"))
76
  MIN_SEP_S = float(os.getenv("MIN_SEP_S", "1.2")) # min gap between events (s)
 
577
  visible=False
578
  )
579
 
580
+ def run(video_file):
581
  if not video_file:
582
+ return [], "Please upload a video file."
583
+ clips, status_msg = extract_score_clips(video_file, debug=False)
584
+ return clips, status_msg
585
+
586
+ run_btn.click(fn=run, inputs=in_video, outputs=[gallery, status])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
587
 
588
  if __name__ == "__main__":
589
+ demo.launch(server_name="0.0.0.0", server_port=7860, show_api=False)
590
+