Spaces:
Sleeping
Sleeping
aether-raider commited on
Commit ·
02c7c7b
1
Parent(s): 38e829d
removed back button
Browse files- backend/__pycache__/data_manager.cpython-311.pyc +0 -0
- backend/__pycache__/session_manager.cpython-311.pyc +0 -0
- backend/data_manager.py +0 -17
- frontend/app.py +0 -31
- frontend/pages/__pycache__/ab_gender.cpython-311.pyc +0 -0
- frontend/pages/__pycache__/ab_model.cpython-311.pyc +0 -0
- frontend/pages/__pycache__/conclusion.cpython-311.pyc +0 -0
- frontend/pages/__pycache__/mos.cpython-311.pyc +0 -0
- frontend/pages/ab_gender.py +3 -17
- frontend/pages/ab_model.py +3 -17
- frontend/pages/conclusion.py +2 -16
- frontend/pages/mos.py +3 -15
backend/__pycache__/data_manager.cpython-311.pyc
CHANGED
|
Binary files a/backend/__pycache__/data_manager.cpython-311.pyc and b/backend/__pycache__/data_manager.cpython-311.pyc differ
|
|
|
backend/__pycache__/session_manager.cpython-311.pyc
CHANGED
|
Binary files a/backend/__pycache__/session_manager.cpython-311.pyc and b/backend/__pycache__/session_manager.cpython-311.pyc differ
|
|
|
backend/data_manager.py
CHANGED
|
@@ -31,22 +31,6 @@ class DataManager:
|
|
| 31 |
Returns file path or data URL that Gradio can handle.
|
| 32 |
"""
|
| 33 |
try:
|
| 34 |
-
# Method 1: Check if it has a file path (common with LFS)
|
| 35 |
-
path = None
|
| 36 |
-
if isinstance(audio_val, dict):
|
| 37 |
-
path = audio_val.get("path")
|
| 38 |
-
else:
|
| 39 |
-
try:
|
| 40 |
-
path = audio_val["path"]
|
| 41 |
-
except Exception:
|
| 42 |
-
path = getattr(audio_val, "path", None)
|
| 43 |
-
|
| 44 |
-
if path and isinstance(path, str):
|
| 45 |
-
# For LFS files, return the path directly - Gradio can handle it
|
| 46 |
-
print(f"[DEBUG] Using audio path: {path}")
|
| 47 |
-
return path
|
| 48 |
-
|
| 49 |
-
# Method 2: Try to get array data (for non-LFS files)
|
| 50 |
array = None
|
| 51 |
sr = None
|
| 52 |
if isinstance(audio_val, dict):
|
|
@@ -67,7 +51,6 @@ class DataManager:
|
|
| 67 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as tmp_file:
|
| 68 |
sf.write(tmp_file.name, np.array(array), int(sr))
|
| 69 |
return tmp_file.name
|
| 70 |
-
|
| 71 |
except Exception as e:
|
| 72 |
print(f"[WARN] Failed to process audio data: {e}")
|
| 73 |
|
|
|
|
| 31 |
Returns file path or data URL that Gradio can handle.
|
| 32 |
"""
|
| 33 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
array = None
|
| 35 |
sr = None
|
| 36 |
if isinstance(audio_val, dict):
|
|
|
|
| 51 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as tmp_file:
|
| 52 |
sf.write(tmp_file.name, np.array(array), int(sr))
|
| 53 |
return tmp_file.name
|
|
|
|
| 54 |
except Exception as e:
|
| 55 |
print(f"[WARN] Failed to process audio data: {e}")
|
| 56 |
|
frontend/app.py
CHANGED
|
@@ -68,28 +68,24 @@ def create_app(data_manager, session_manager):
|
|
| 68 |
|
| 69 |
(
|
| 70 |
mos_page,
|
| 71 |
-
back_to_samples_btn,
|
| 72 |
continue_mos_btn,
|
| 73 |
mos_dynamic_content
|
| 74 |
) = build_mos_page()
|
| 75 |
|
| 76 |
(
|
| 77 |
ab_model_page,
|
| 78 |
-
back_to_mos_btn,
|
| 79 |
continue_ab_model_btn,
|
| 80 |
ab_model_dynamic_content,
|
| 81 |
) = build_ab_model_page()
|
| 82 |
|
| 83 |
(
|
| 84 |
ab_gender_page,
|
| 85 |
-
back_to_ab_model_btn,
|
| 86 |
continue_ab_gender_btn,
|
| 87 |
ab_gender_dynamic_content,
|
| 88 |
) = build_ab_gender_page()
|
| 89 |
|
| 90 |
(
|
| 91 |
conclusion_page,
|
| 92 |
-
back_to_ab_gender_btn,
|
| 93 |
export_btn,
|
| 94 |
overall_feedback,
|
| 95 |
final_comments,
|
|
@@ -315,33 +311,6 @@ def create_app(data_manager, session_manager):
|
|
| 315 |
js=SCROLL_TO_TOP_JS
|
| 316 |
)
|
| 317 |
|
| 318 |
-
back_to_samples_btn.click(
|
| 319 |
-
lambda: (gr.update(visible=False), gr.update(visible=True)),
|
| 320 |
-
inputs=[],
|
| 321 |
-
outputs=[mos_page, sample_page],
|
| 322 |
-
js=SCROLL_TO_TOP_JS
|
| 323 |
-
)
|
| 324 |
-
|
| 325 |
-
back_to_mos_btn.click(
|
| 326 |
-
lambda: (gr.update(visible=False), gr.update(visible=True)),
|
| 327 |
-
inputs=[],
|
| 328 |
-
outputs=[ab_model_page, mos_page],
|
| 329 |
-
js=SCROLL_TO_TOP_JS
|
| 330 |
-
)
|
| 331 |
-
|
| 332 |
-
back_to_ab_model_btn.click(
|
| 333 |
-
lambda: (gr.update(visible=False), gr.update(visible=True)),
|
| 334 |
-
inputs=[],
|
| 335 |
-
outputs=[ab_gender_page, ab_model_page],
|
| 336 |
-
js=SCROLL_TO_TOP_JS
|
| 337 |
-
)
|
| 338 |
-
|
| 339 |
-
back_to_ab_gender_btn.click(
|
| 340 |
-
lambda: (gr.update(visible=False), gr.update(visible=True)),
|
| 341 |
-
inputs=[],
|
| 342 |
-
outputs=[conclusion_page, ab_gender_page],
|
| 343 |
-
js=SCROLL_TO_TOP_JS
|
| 344 |
-
)
|
| 345 |
|
| 346 |
return app
|
| 347 |
|
|
|
|
| 68 |
|
| 69 |
(
|
| 70 |
mos_page,
|
|
|
|
| 71 |
continue_mos_btn,
|
| 72 |
mos_dynamic_content
|
| 73 |
) = build_mos_page()
|
| 74 |
|
| 75 |
(
|
| 76 |
ab_model_page,
|
|
|
|
| 77 |
continue_ab_model_btn,
|
| 78 |
ab_model_dynamic_content,
|
| 79 |
) = build_ab_model_page()
|
| 80 |
|
| 81 |
(
|
| 82 |
ab_gender_page,
|
|
|
|
| 83 |
continue_ab_gender_btn,
|
| 84 |
ab_gender_dynamic_content,
|
| 85 |
) = build_ab_gender_page()
|
| 86 |
|
| 87 |
(
|
| 88 |
conclusion_page,
|
|
|
|
| 89 |
export_btn,
|
| 90 |
overall_feedback,
|
| 91 |
final_comments,
|
|
|
|
| 311 |
js=SCROLL_TO_TOP_JS
|
| 312 |
)
|
| 313 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 314 |
|
| 315 |
return app
|
| 316 |
|
frontend/pages/__pycache__/ab_gender.cpython-311.pyc
CHANGED
|
Binary files a/frontend/pages/__pycache__/ab_gender.cpython-311.pyc and b/frontend/pages/__pycache__/ab_gender.cpython-311.pyc differ
|
|
|
frontend/pages/__pycache__/ab_model.cpython-311.pyc
CHANGED
|
Binary files a/frontend/pages/__pycache__/ab_model.cpython-311.pyc and b/frontend/pages/__pycache__/ab_model.cpython-311.pyc differ
|
|
|
frontend/pages/__pycache__/conclusion.cpython-311.pyc
CHANGED
|
Binary files a/frontend/pages/__pycache__/conclusion.cpython-311.pyc and b/frontend/pages/__pycache__/conclusion.cpython-311.pyc differ
|
|
|
frontend/pages/__pycache__/mos.cpython-311.pyc
CHANGED
|
Binary files a/frontend/pages/__pycache__/mos.cpython-311.pyc and b/frontend/pages/__pycache__/mos.cpython-311.pyc differ
|
|
|
frontend/pages/ab_gender.py
CHANGED
|
@@ -34,25 +34,11 @@ def build_ab_gender_page():
|
|
| 34 |
value="<p>Loading gender comparisons...</p>", visible=True
|
| 35 |
)
|
| 36 |
|
| 37 |
-
gr.
|
| 38 |
-
"""
|
| 39 |
-
<div style="background: #7f1d1d; padding: 12px; border-radius: 8px; border: 2px solid #ef4444; margin: 15px 0;">
|
| 40 |
-
<p style="margin: 0; color: #fca5a5; font-weight: bold;">
|
| 41 |
-
⚠️ Warning: Using the "Back" button will lose all your comparisons on this page!
|
| 42 |
-
</p>
|
| 43 |
-
</div>
|
| 44 |
-
"""
|
| 45 |
)
|
| 46 |
|
| 47 |
-
|
| 48 |
-
back_btn = gr.Button(
|
| 49 |
-
"Back to Model Comparisons", variant="secondary"
|
| 50 |
-
)
|
| 51 |
-
continue_btn = gr.Button(
|
| 52 |
-
"Complete Evaluation", variant="primary"
|
| 53 |
-
)
|
| 54 |
-
|
| 55 |
-
return ab_gender_page, back_btn, continue_btn, ab_gender_dynamic_content
|
| 56 |
|
| 57 |
|
| 58 |
def render_ab_gender_html(session: Dict[str, Any]) -> str:
|
|
|
|
| 34 |
value="<p>Loading gender comparisons...</p>", visible=True
|
| 35 |
)
|
| 36 |
|
| 37 |
+
continue_btn = gr.Button(
|
| 38 |
+
"Complete Evaluation", variant="primary"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
)
|
| 40 |
|
| 41 |
+
return ab_gender_page, continue_btn, ab_gender_dynamic_content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
|
| 44 |
def render_ab_gender_html(session: Dict[str, Any]) -> str:
|
frontend/pages/ab_model.py
CHANGED
|
@@ -34,25 +34,11 @@ def build_ab_model_page():
|
|
| 34 |
value="<p>Loading model comparisons...</p>", visible=True
|
| 35 |
)
|
| 36 |
|
| 37 |
-
gr.
|
| 38 |
-
"""
|
| 39 |
-
<div style="background: #7f1d1d; padding: 12px; border-radius: 8px; border: 2px solid #ef4444; margin: 15px 0;">
|
| 40 |
-
<p style="margin: 0; color: #fca5a5; font-weight: bold;">
|
| 41 |
-
⚠️ Warning: Using the "Back" button will lose all your comparisons on this page!
|
| 42 |
-
</p>
|
| 43 |
-
</div>
|
| 44 |
-
"""
|
| 45 |
)
|
| 46 |
|
| 47 |
-
|
| 48 |
-
back_btn = gr.Button(
|
| 49 |
-
"Back to Model Ratings", variant="secondary"
|
| 50 |
-
)
|
| 51 |
-
continue_btn = gr.Button(
|
| 52 |
-
"Continue to Gender Comparisons", variant="primary"
|
| 53 |
-
)
|
| 54 |
-
|
| 55 |
-
return ab_model_page, back_btn, continue_btn, ab_model_dynamic_content
|
| 56 |
|
| 57 |
|
| 58 |
def render_ab_model_html(session: Dict[str, Any]) -> str:
|
|
|
|
| 34 |
value="<p>Loading model comparisons...</p>", visible=True
|
| 35 |
)
|
| 36 |
|
| 37 |
+
continue_btn = gr.Button(
|
| 38 |
+
"Continue to Gender Comparisons", variant="primary"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
)
|
| 40 |
|
| 41 |
+
return ab_model_page, continue_btn, ab_model_dynamic_content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
|
| 44 |
def render_ab_model_html(session: Dict[str, Any]) -> str:
|
frontend/pages/conclusion.py
CHANGED
|
@@ -36,20 +36,6 @@ def build_conclusion_page():
|
|
| 36 |
lines=4,
|
| 37 |
)
|
| 38 |
|
| 39 |
-
gr.
|
| 40 |
-
"""
|
| 41 |
-
<div style="background: #7f1d1d; padding: 12px; border-radius: 8px; border: 2px solid #ef4444; margin: 15px 0;">
|
| 42 |
-
<p style="margin: 0; color: #fca5a5; font-weight: bold;">
|
| 43 |
-
⚠️ Warning: Using the "Back" button will lose all your previous submissions!
|
| 44 |
-
</p>
|
| 45 |
-
</div>
|
| 46 |
-
"""
|
| 47 |
-
)
|
| 48 |
-
|
| 49 |
-
with gr.Row():
|
| 50 |
-
back_btn = gr.Button(
|
| 51 |
-
"Back to Gender Comparisons", variant="secondary"
|
| 52 |
-
)
|
| 53 |
-
export_btn = gr.Button("Submit Results", variant="primary")
|
| 54 |
|
| 55 |
-
return conclusion_page,
|
|
|
|
| 36 |
lines=4,
|
| 37 |
)
|
| 38 |
|
| 39 |
+
export_btn = gr.Button("Submit Results", variant="primary")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
return conclusion_page, export_btn, overall_feedback, final_comments
|
frontend/pages/mos.py
CHANGED
|
@@ -47,23 +47,11 @@ def build_mos_page():
|
|
| 47 |
|
| 48 |
mos_dynamic_content = gr.HTML(value="<p>Loading clips...</p>", visible=True)
|
| 49 |
|
| 50 |
-
gr.
|
| 51 |
-
"""
|
| 52 |
-
<div style="background: #7f1d1d; padding: 12px; border-radius: 8px; border: 2px solid #ef4444; margin: 15px 0;">
|
| 53 |
-
<p style="margin: 0; color: #fca5a5; font-weight: bold;">
|
| 54 |
-
⚠️ Warning: Using the "Back" button will lose all your ratings on this page!
|
| 55 |
-
</p>
|
| 56 |
-
</div>
|
| 57 |
-
"""
|
| 58 |
)
|
| 59 |
|
| 60 |
-
|
| 61 |
-
back_btn = gr.Button("Back to Reference Audio", variant="secondary")
|
| 62 |
-
continue_btn = gr.Button(
|
| 63 |
-
"Continue to Model Comparisons", variant="primary"
|
| 64 |
-
)
|
| 65 |
-
|
| 66 |
-
return mos_page, back_btn, continue_btn, mos_dynamic_content
|
| 67 |
|
| 68 |
|
| 69 |
def render_mos_html(session) -> str:
|
|
|
|
| 47 |
|
| 48 |
mos_dynamic_content = gr.HTML(value="<p>Loading clips...</p>", visible=True)
|
| 49 |
|
| 50 |
+
continue_btn = gr.Button(
|
| 51 |
+
"Continue to Model Comparisons", variant="primary"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
)
|
| 53 |
|
| 54 |
+
return mos_page, continue_btn, mos_dynamic_content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
|
| 57 |
def render_mos_html(session) -> str:
|