Upload app.py
Browse files
app.py
CHANGED
|
@@ -564,8 +564,12 @@ with gr.Blocks(title="Plotweaver AI — TTS MOS Evaluation",
|
|
| 564 |
gr.Markdown("# 🎧 Plotweaver AI — TTS MOS Evaluation", elem_id="app-title")
|
| 565 |
gr.Markdown("Rate synthesised speech on 7 quality criteria, by language.", elem_id="app-sub")
|
| 566 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 567 |
# ----------------------------- AUTH ------------------------------------ #
|
| 568 |
-
with gr.Column(visible=
|
| 569 |
with gr.Column(elem_classes="soft-card"):
|
| 570 |
with gr.Tabs():
|
| 571 |
with gr.Tab("Sign in"):
|
|
@@ -1020,9 +1024,12 @@ with gr.Blocks(title="Plotweaver AI — TTS MOS Evaluation",
|
|
| 1020 |
def restore_session(token):
|
| 1021 |
uid = verify_token(token)
|
| 1022 |
if not uid:
|
| 1023 |
-
#
|
| 1024 |
-
return (gr.update(),
|
| 1025 |
-
gr.update(),
|
|
|
|
|
|
|
|
|
|
| 1026 |
sess = user_session(uid)
|
| 1027 |
is_admin = sess["role"] == "admin"
|
| 1028 |
rl = reviewer_lang_choices(sess)
|
|
@@ -1034,6 +1041,7 @@ with gr.Blocks(title="Plotweaver AI — TTS MOS Evaluation",
|
|
| 1034 |
lt, st, ut = [], [], []
|
| 1035 |
du, tu = gr.update(), gr.update()
|
| 1036 |
return (
|
|
|
|
| 1037 |
gr.update(visible=False), # auth_col
|
| 1038 |
gr.update(visible=True), # app_col
|
| 1039 |
sess, # session
|
|
@@ -1044,8 +1052,8 @@ with gr.Blocks(title="Plotweaver AI — TTS MOS Evaluation",
|
|
| 1044 |
lt, st, ut, du, tu, # admin tables + pickers
|
| 1045 |
)
|
| 1046 |
demo.load(restore_session, [auth_token],
|
| 1047 |
-
[auth_col, app_col, session, greeting, reviewer_tabs, admin_panel,
|
| 1048 |
-
langs_tbl, samples_tbl, users_tbl, del_sample, tr_sample])
|
| 1049 |
|
| 1050 |
# Refresh language-dependent choices on every page load, so newly added
|
| 1051 |
# languages appear in the signup form (and admin dropdowns) without a restart.
|
|
|
|
| 564 |
gr.Markdown("# 🎧 Plotweaver AI — TTS MOS Evaluation", elem_id="app-title")
|
| 565 |
gr.Markdown("Rate synthesised speech on 7 quality criteria, by language.", elem_id="app-sub")
|
| 566 |
|
| 567 |
+
# ---------- Loading (shown first, until the browser session is checked) ----------
|
| 568 |
+
with gr.Column(visible=True, elem_id="auth-wrap") as loading_col:
|
| 569 |
+
gr.Markdown("### Loading…")
|
| 570 |
+
|
| 571 |
# ----------------------------- AUTH ------------------------------------ #
|
| 572 |
+
with gr.Column(visible=False, elem_id="auth-wrap") as auth_col:
|
| 573 |
with gr.Column(elem_classes="soft-card"):
|
| 574 |
with gr.Tabs():
|
| 575 |
with gr.Tab("Sign in"):
|
|
|
|
| 1024 |
def restore_session(token):
|
| 1025 |
uid = verify_token(token)
|
| 1026 |
if not uid:
|
| 1027 |
+
# not logged in: hide loading, show the sign-in screen
|
| 1028 |
+
return (gr.update(visible=False), # loading_col
|
| 1029 |
+
gr.update(visible=True), # auth_col
|
| 1030 |
+
gr.update(visible=False), # app_col
|
| 1031 |
+
None, gr.update(), gr.update(), gr.update(), gr.update(),
|
| 1032 |
+
[], [], [], gr.update(), gr.update())
|
| 1033 |
sess = user_session(uid)
|
| 1034 |
is_admin = sess["role"] == "admin"
|
| 1035 |
rl = reviewer_lang_choices(sess)
|
|
|
|
| 1041 |
lt, st, ut = [], [], []
|
| 1042 |
du, tu = gr.update(), gr.update()
|
| 1043 |
return (
|
| 1044 |
+
gr.update(visible=False), # loading_col
|
| 1045 |
gr.update(visible=False), # auth_col
|
| 1046 |
gr.update(visible=True), # app_col
|
| 1047 |
sess, # session
|
|
|
|
| 1052 |
lt, st, ut, du, tu, # admin tables + pickers
|
| 1053 |
)
|
| 1054 |
demo.load(restore_session, [auth_token],
|
| 1055 |
+
[loading_col, auth_col, app_col, session, greeting, reviewer_tabs, admin_panel,
|
| 1056 |
+
rate_lang, langs_tbl, samples_tbl, users_tbl, del_sample, tr_sample])
|
| 1057 |
|
| 1058 |
# Refresh language-dependent choices on every page load, so newly added
|
| 1059 |
# languages appear in the signup form (and admin dropdowns) without a restart.
|