PlotweaverModel commited on
Commit
82bd757
·
verified ·
1 Parent(s): 89cee01

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -478,7 +478,7 @@ with gr.Blocks(title="Plotweaver AI — TTS MOS Evaluation",
478
 
479
  with gr.Tabs():
480
  # ---------- Rate tab ----------
481
- with gr.Tab("Rate samples"):
482
  with gr.Row():
483
  rate_lang = gr.Dropdown(label="Language", choices=[], interactive=True,
484
  allow_custom_value=True, scale=2)
@@ -513,14 +513,14 @@ with gr.Blocks(title="Plotweaver AI — TTS MOS Evaluation",
513
  rate_msg = gr.Markdown()
514
 
515
  # ---------- Progress tab ----------
516
- with gr.Tab("My progress"):
517
  refresh_prog_btn = gr.Button("Refresh", size="sm")
518
  progress_md = gr.Markdown()
519
  progress_tbl = gr.Dataframe(
520
  headers=["Language", "Rated", "Total", "Remaining"], interactive=False)
521
 
522
  # ---------- Profile tab ----------
523
- with gr.Tab("My languages"):
524
  gr.Markdown("Choose which languages you are eligible to evaluate.")
525
  prof_langs = gr.CheckboxGroup(label="Languages", choices=lang_choices())
526
  prof_save = gr.Button("Save", variant="primary", size="sm")
@@ -591,8 +591,8 @@ with gr.Blocks(title="Plotweaver AI — TTS MOS Evaluation",
591
  if not user:
592
  # keep typed credentials so the user can correct them
593
  return (gr.update(), gr.update(), None, "❌ Invalid username or password.",
594
- gr.update(), gr.update(), gr.update(), gr.update(),
595
- gr.update(), gr.update())
596
  sess = user_session(user["id"])
597
  is_admin = sess["role"] == "admin"
598
  rl = reviewer_lang_choices(sess)
@@ -603,6 +603,9 @@ with gr.Blocks(title="Plotweaver AI — TTS MOS Evaluation",
603
  "", # li_msg
604
  gr.update(value=f"Signed in as **{sess['username']}** · {sess['role']}"), # greeting
605
  gr.update(visible=is_admin), # admin_tab
 
 
 
606
  gr.update(choices=rl, value=None), # rate_lang
607
  gr.update(choices=lang_choices(),
608
  value=[l["id"] for l in sess["languages"]]), # prof_langs
@@ -612,13 +615,13 @@ with gr.Blocks(title="Plotweaver AI — TTS MOS Evaluation",
612
 
613
  li_btn.click(
614
  do_login, [li_user, li_pw],
615
- [auth_col, app_col, session, li_msg, greeting, admin_tab, rate_lang, prof_langs,
616
- li_user, li_pw],
617
  )
618
  li_pw.submit( # allow Enter-to-login
619
  do_login, [li_user, li_pw],
620
- [auth_col, app_col, session, li_msg, greeting, admin_tab, rate_lang, prof_langs,
621
- li_user, li_pw],
622
  )
623
 
624
  def do_signup(username, email, password, lang_ids, code):
 
478
 
479
  with gr.Tabs():
480
  # ---------- Rate tab ----------
481
+ with gr.Tab("Rate samples") as rate_tab:
482
  with gr.Row():
483
  rate_lang = gr.Dropdown(label="Language", choices=[], interactive=True,
484
  allow_custom_value=True, scale=2)
 
513
  rate_msg = gr.Markdown()
514
 
515
  # ---------- Progress tab ----------
516
+ with gr.Tab("My progress") as progress_tab:
517
  refresh_prog_btn = gr.Button("Refresh", size="sm")
518
  progress_md = gr.Markdown()
519
  progress_tbl = gr.Dataframe(
520
  headers=["Language", "Rated", "Total", "Remaining"], interactive=False)
521
 
522
  # ---------- Profile tab ----------
523
+ with gr.Tab("My languages") as langs_tab:
524
  gr.Markdown("Choose which languages you are eligible to evaluate.")
525
  prof_langs = gr.CheckboxGroup(label="Languages", choices=lang_choices())
526
  prof_save = gr.Button("Save", variant="primary", size="sm")
 
591
  if not user:
592
  # keep typed credentials so the user can correct them
593
  return (gr.update(), gr.update(), None, "❌ Invalid username or password.",
594
+ gr.update(), gr.update(), gr.update(), gr.update(), gr.update(),
595
+ gr.update(), gr.update(), gr.update(), gr.update())
596
  sess = user_session(user["id"])
597
  is_admin = sess["role"] == "admin"
598
  rl = reviewer_lang_choices(sess)
 
603
  "", # li_msg
604
  gr.update(value=f"Signed in as **{sess['username']}** · {sess['role']}"), # greeting
605
  gr.update(visible=is_admin), # admin_tab
606
+ gr.update(visible=not is_admin), # rate_tab
607
+ gr.update(visible=not is_admin), # progress_tab
608
+ gr.update(visible=not is_admin), # langs_tab
609
  gr.update(choices=rl, value=None), # rate_lang
610
  gr.update(choices=lang_choices(),
611
  value=[l["id"] for l in sess["languages"]]), # prof_langs
 
615
 
616
  li_btn.click(
617
  do_login, [li_user, li_pw],
618
+ [auth_col, app_col, session, li_msg, greeting, admin_tab,
619
+ rate_tab, progress_tab, langs_tab, rate_lang, prof_langs, li_user, li_pw],
620
  )
621
  li_pw.submit( # allow Enter-to-login
622
  do_login, [li_user, li_pw],
623
+ [auth_col, app_col, session, li_msg, greeting, admin_tab,
624
+ rate_tab, progress_tab, langs_tab, rate_lang, prof_langs, li_user, li_pw],
625
  )
626
 
627
  def do_signup(username, email, password, lang_ids, code):