mozzic commited on
Commit
53d40b5
·
verified ·
1 Parent(s): c6f4d6b
Files changed (1) hide show
  1. app.py +17 -8
app.py CHANGED
@@ -309,10 +309,16 @@ def start_debate_round(topic, stance, language, gender, session_id):
309
  )
310
 
311
  def update_timer_display():
312
- """Update timer display"""
313
  time_left = debate_timer.get_time_left()
314
  return format_time(time_left)
315
 
 
 
 
 
 
 
316
  def process_round_end(user_argument, session_id):
317
  """Process the end of a round and generate AI response"""
318
  global debate_sessions, debate_timer
@@ -404,11 +410,13 @@ with gr.Blocks(title="3-Round Timed Debate System", theme=gr.themes.Soft()) as d
404
  timer_display = gr.Textbox(
405
  label="⏰ Time Remaining",
406
  value="05:00",
407
- interactive=False
 
408
  )
409
 
410
  start_round_btn = gr.Button("🚀 Start New Round", variant="primary", size="lg")
411
  submit_round_btn = gr.Button("✅ Submit Round", variant="secondary", interactive=False)
 
412
 
413
  # Debate Interface
414
  with gr.Row():
@@ -490,13 +498,14 @@ with gr.Blocks(title="3-Round Timed Debate System", theme=gr.themes.Soft()) as d
490
  outputs=[status_output, timer_display, ai_response_output, ai_audio_output, start_round_btn]
491
  )
492
 
493
- # Auto-update timer every second
494
- demo.load(
495
- lambda: gr.update(),
496
- None,
497
- timer_display,
498
- every=1
499
  )
 
 
 
500
 
501
  # -----------------------------
502
  # 8️⃣ Launch app
 
309
  )
310
 
311
  def update_timer_display():
312
+ """Update timer display - manual refresh"""
313
  time_left = debate_timer.get_time_left()
314
  return format_time(time_left)
315
 
316
+ def get_current_timer():
317
+ """Get current timer status"""
318
+ if debate_timer.is_running:
319
+ return format_time(debate_timer.get_time_left())
320
+ return "00:00"
321
+
322
  def process_round_end(user_argument, session_id):
323
  """Process the end of a round and generate AI response"""
324
  global debate_sessions, debate_timer
 
410
  timer_display = gr.Textbox(
411
  label="⏰ Time Remaining",
412
  value="05:00",
413
+ interactive=False,
414
+ info="Timer updates when you interact with buttons"
415
  )
416
 
417
  start_round_btn = gr.Button("🚀 Start New Round", variant="primary", size="lg")
418
  submit_round_btn = gr.Button("✅ Submit Round", variant="secondary", interactive=False)
419
+ check_timer_btn = gr.Button("🕒 Check Timer", variant="secondary", size="sm")
420
 
421
  # Debate Interface
422
  with gr.Row():
 
498
  outputs=[status_output, timer_display, ai_response_output, ai_audio_output, start_round_btn]
499
  )
500
 
501
+ # Check timer button
502
+ check_timer_btn.click(
503
+ get_current_timer,
504
+ outputs=[timer_display]
 
 
505
  )
506
+
507
+ # Timer updates will be handled manually through button clicks
508
+ # Note: Auto-timer updates require Gradio Pro features
509
 
510
  # -----------------------------
511
  # 8️⃣ Launch app