jfforero commited on
Commit
ea0df88
·
verified ·
1 Parent(s): 0409537

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -7
app.py CHANGED
@@ -22,6 +22,7 @@ import soundfile as sf
22
  from pydub import AudioSegment
23
  import math
24
  import json
 
25
 
26
  # Load the emotion prediction model
27
  def load_emotion_model(model_path):
@@ -404,13 +405,18 @@ with gr.Blocks(title="Affective Virtual Environments - Chunked Processing") as i
404
  process_btn = gr.Button("Process Audio", variant="primary")
405
  clear_btn = gr.Button("Clear All", variant="secondary")
406
 
407
- # Add a loading indicator - Fixed CSS syntax error by escaping % signs
408
  loading_indicator = gr.HTML("""
409
  <div id="loading" style="display: none; text-align: center; margin: 20px;">
410
  <p style="font-size: 18px; color: #4a4a4a;">Processing audio chunks...</p>
411
  <div style="border: 4px solid #f3f3f3; border-top: 4px solid #3498db; border-radius: 50%; width: 30px; height: 30px; animation: spin 2s linear infinite; margin: 0 auto;"></div>
412
- <style>@keyframes spin { 0%% { transform: rotate(0deg); } 100%% { transform: rotate(360deg); } }</style>
413
  </div>
 
 
 
 
 
 
414
  """)
415
 
416
  # Create output components for each chunk type
@@ -444,14 +450,19 @@ with gr.Blocks(title="Affective Virtual Environments - Chunked Processing") as i
444
  if chunk_duration is None or chunk_duration <= 0:
445
  chunk_duration = 10
446
 
447
- # Show loading indicator - Fixed CSS syntax error by escaping % signs
448
- yield [gr.HTML(f"""
449
  <div style="text-align: center; margin: 20px;">
450
- <p style="font-size: 18px; color: #4a4a4a;">Processing audio in {chunk_duration}-second chunks...</p>
451
  <div style="border: 4px solid #f3f3f3; border-top: 4px solid #3498db; border-radius: 50%; width: 30px; height: 30px; animation: spin 2s linear infinite; margin: 0 auto;"></div>
452
- <style>@keyframes spin {{ 0%% {{ transform: rotate(0deg); }} 100%% {{ transform: rotate(360deg); }} }}</style>
453
  </div>
454
- """)] + [gr.Group(visible=False)] * len(group_components) + [None] * (len(output_containers) * 5)
 
 
 
 
 
 
455
 
456
  results = get_predictions(audio_input, generate_audio, chunk_duration)
457
 
 
22
  from pydub import AudioSegment
23
  import math
24
  import json
25
+ import time
26
 
27
  # Load the emotion prediction model
28
  def load_emotion_model(model_path):
 
405
  process_btn = gr.Button("Process Audio", variant="primary")
406
  clear_btn = gr.Button("Clear All", variant="secondary")
407
 
408
+ # Add a loading indicator with proper CSS animation
409
  loading_indicator = gr.HTML("""
410
  <div id="loading" style="display: none; text-align: center; margin: 20px;">
411
  <p style="font-size: 18px; color: #4a4a4a;">Processing audio chunks...</p>
412
  <div style="border: 4px solid #f3f3f3; border-top: 4px solid #3498db; border-radius: 50%; width: 30px; height: 30px; animation: spin 2s linear infinite; margin: 0 auto;"></div>
 
413
  </div>
414
+ <style>
415
+ @keyframes spin {
416
+ 0% { transform: rotate(0deg); }
417
+ 100% { transform: rotate(360deg); }
418
+ }
419
+ </style>
420
  """)
421
 
422
  # Create output components for each chunk type
 
450
  if chunk_duration is None or chunk_duration <= 0:
451
  chunk_duration = 10
452
 
453
+ # Show loading indicator with proper animation
454
+ yield [gr.HTML("""
455
  <div style="text-align: center; margin: 20px;">
456
+ <p style="font-size: 18px; color: #4a4a4a;">Processing audio in {}-second chunks...</p>
457
  <div style="border: 4px solid #f3f3f3; border-top: 4px solid #3498db; border-radius: 50%; width: 30px; height: 30px; animation: spin 2s linear infinite; margin: 0 auto;"></div>
 
458
  </div>
459
+ <style>
460
+ @keyframes spin {
461
+ 0% { transform: rotate(0deg); }
462
+ 100% { transform: rotate(360deg); }
463
+ }
464
+ </style>
465
+ """.format(chunk_duration))] + [gr.Group(visible=False)] * len(group_components) + [None] * (len(output_containers) * 5)
466
 
467
  results = get_predictions(audio_input, generate_audio, chunk_duration)
468