Newbyl commited on
Commit
d784d44
·
1 Parent(s): df2b7b4

modif app

Browse files
Files changed (2) hide show
  1. app.py +16 -1
  2. votes.csv +1 -0
app.py CHANGED
@@ -409,6 +409,10 @@ def on_import_votes(file):
409
  gr.update(interactive=not disable),
410
  )
411
 
 
 
 
 
412
 
413
  # ----------------------------
414
  # App initialization
@@ -436,7 +440,6 @@ def initialize():
436
  # Initialize on import
437
  initialize()
438
 
439
-
440
  # ----------------------------
441
  # Gradio UI
442
  # ----------------------------
@@ -464,6 +467,11 @@ with gr.Blocks(title="Scientific Video Comparison Study") as demo:
464
  votes_file = gr.File(label="Resume from saved votes.csv", file_types=[".csv"])
465
  btn_import = gr.Button("Import & Resume")
466
 
 
 
 
 
 
467
  with gr.Row():
468
  btn_left = gr.Button("Left Video is Better", variant="primary")
469
  btn_right = gr.Button("Right Video is Better", variant="primary")
@@ -494,6 +502,13 @@ with gr.Blocks(title="Scientific Video Comparison Study") as demo:
494
  outputs=[left_video, right_video, progress, status, state, btn_left, btn_right],
495
  )
496
 
 
 
 
 
 
 
 
497
  # Client-side JS to toggle both <video> elements simultaneously
498
  btn_toggle.click(
499
  fn=None,
 
409
  gr.update(interactive=not disable),
410
  )
411
 
412
+ def on_download_votes():
413
+ """Return the path to votes.csv so Gradio can offer it for download."""
414
+ ensure_votes_csv()
415
+ return str(VOTES_CSV)
416
 
417
  # ----------------------------
418
  # App initialization
 
440
  # Initialize on import
441
  initialize()
442
 
 
443
  # ----------------------------
444
  # Gradio UI
445
  # ----------------------------
 
467
  votes_file = gr.File(label="Resume from saved votes.csv", file_types=[".csv"])
468
  btn_import = gr.Button("Import & Resume")
469
 
470
+ # Download section: get the current votes.csv
471
+ with gr.Row():
472
+ btn_download = gr.Button("Download votes.csv")
473
+ download_file = gr.File(label="Click to download votes.csv", interactive=False)
474
+
475
  with gr.Row():
476
  btn_left = gr.Button("Left Video is Better", variant="primary")
477
  btn_right = gr.Button("Right Video is Better", variant="primary")
 
502
  outputs=[left_video, right_video, progress, status, state, btn_left, btn_right],
503
  )
504
 
505
+ # Download votes.csv
506
+ btn_download.click(
507
+ fn=on_download_votes,
508
+ inputs=None,
509
+ outputs=[download_file],
510
+ )
511
+
512
  # Client-side JS to toggle both <video> elements simultaneously
513
  btn_toggle.click(
514
  fn=None,
votes.csv CHANGED
@@ -1,4 +1,5 @@
1
  method1,method2,video_name,winner,timestamp
 
2
  real3d,xportrait,0uRPjLPetcw#id0#12_344.mp4,xportrait,2025-08-26T17:34:43.403739
3
  emoportrait,hallo2,I92UMxZhEww#id0__1#64_218.mp4,hallo2,2025-08-26T17:34:47.370388
4
  dagan,wav2lip,JTVeGs76BQs#id43#14844_15498.mp4,dagan,2025-08-26T17:34:53.191589
 
1
  method1,method2,video_name,winner,timestamp
2
+
3
  real3d,xportrait,0uRPjLPetcw#id0#12_344.mp4,xportrait,2025-08-26T17:34:43.403739
4
  emoportrait,hallo2,I92UMxZhEww#id0__1#64_218.mp4,hallo2,2025-08-26T17:34:47.370388
5
  dagan,wav2lip,JTVeGs76BQs#id43#14844_15498.mp4,dagan,2025-08-26T17:34:53.191589