kathiasi commited on
Commit
8dfc10c
·
verified ·
1 Parent(s): 9f4446e

New try on progress bar

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -291,7 +291,7 @@ def make_ui():
291
 
292
  # --- UI ELEMENT LISTS ---
293
  main_ui_elements = [
294
- title_md, header_md, progress_md, progress_bar, sample_name_md, evaluation_audio,
295
  slider_explanation_md, comment, submit_btn, status, *sliders
296
  ]
297
 
@@ -318,8 +318,7 @@ def make_ui():
318
  slider_explanation_md: gr.update(value="_Move a slider to see the description for each score._", visible=True),
319
  comment: gr.update(value="", visible=True),
320
  submit_btn: gr.update(value="Play audio to enable", interactive=False, visible=True),
321
- status: gr.update(value="Ready.", visible=True),
322
- progress_bar: gr.update(value=(index + 1) / total_samples, visible=True)
323
  }
324
  num_criteria = len(config['criteria'])
325
  for i in range(MAX_CRITERIA):
@@ -393,6 +392,12 @@ def make_ui():
393
  save_status = save_response(sample, sample_path, annotator, sid, email, comment, scores, config)
394
 
395
  next_index = index + 1
 
 
 
 
 
 
396
  updates_dict = load_sample(samples, next_index, config)
397
  # Provide more detailed status, including HF info if available
398
  status_message = f"Saved {sample} locally."
@@ -435,4 +440,4 @@ def make_ui():
435
 
436
  if __name__ == "__main__":
437
  app = make_ui()
438
- app.launch(server_name="0.0.0.0", server_port=7860)
 
291
 
292
  # --- UI ELEMENT LISTS ---
293
  main_ui_elements = [
294
+ title_md, header_md, progress_md, sample_name_md, evaluation_audio,
295
  slider_explanation_md, comment, submit_btn, status, *sliders
296
  ]
297
 
 
318
  slider_explanation_md: gr.update(value="_Move a slider to see the description for each score._", visible=True),
319
  comment: gr.update(value="", visible=True),
320
  submit_btn: gr.update(value="Play audio to enable", interactive=False, visible=True),
321
+ status: gr.update(value="Ready.", visible=True)
 
322
  }
323
  num_criteria = len(config['criteria'])
324
  for i in range(MAX_CRITERIA):
 
392
  save_status = save_response(sample, sample_path, annotator, sid, email, comment, scores, config)
393
 
394
  next_index = index + 1
395
+ total_samples = len(samples)
396
+
397
+ # Update progress bar
398
+ progress_value = (next_index) / total_samples if total_samples > 0 else 0
399
+ progress_bar(progress_value)
400
+
401
  updates_dict = load_sample(samples, next_index, config)
402
  # Provide more detailed status, including HF info if available
403
  status_message = f"Saved {sample} locally."
 
440
 
441
  if __name__ == "__main__":
442
  app = make_ui()
443
+ app.launch(server_name="0.0.0.0", server_port=7860)