Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Commit ·
3813139
1
Parent(s): 130e1be
changes to examples
Browse files- app.py +31 -52
- constants.py +25 -0
app.py
CHANGED
|
@@ -846,71 +846,50 @@ with gr.Blocks(title=APP_TITLE, theme=_theme, css=LEADERBOARD_CSS) as demo:
|
|
| 846 |
|
| 847 |
with gr.TabItem(tab_label("examples", "Examples"), elem_id="examples-tab", id=4):
|
| 848 |
examples_renderer.ensure_assets()
|
| 849 |
-
gr.Markdown(
|
| 850 |
-
"## Condition examples\n\n"
|
| 851 |
-
"Pre-rendered clips illustrate three leaderboard conditions. "
|
| 852 |
-
"See the **About** tab for metric definitions."
|
| 853 |
-
)
|
| 854 |
-
gr.HTML(value=examples_renderer.status_html())
|
| 855 |
_dry = examples_renderer.sample_paths("dry")
|
| 856 |
_hi = examples_renderer.sample_paths("high_snr")
|
| 857 |
_lo = examples_renderer.sample_paths("low_snr")
|
| 858 |
_scene = examples_renderer.scene_image_path()
|
| 859 |
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
|
| 865 |
-
)
|
| 866 |
-
|
| 867 |
-
gr.Markdown(
|
| 868 |
-
"### Dry Speech\n"
|
| 869 |
-
"Close-mic anechoic speech — no room impulse response, no background noise."
|
| 870 |
-
)
|
| 871 |
-
with gr.Row():
|
| 872 |
-
gr.Audio(
|
| 873 |
-
value=_dry[0],
|
| 874 |
-
label="Dry Speech — example 1",
|
| 875 |
interactive=False,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 876 |
)
|
| 877 |
-
|
| 878 |
-
|
| 879 |
-
|
|
|
|
|
|
|
|
|
|
| 880 |
interactive=False,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 881 |
)
|
| 882 |
|
| 883 |
-
gr.Markdown(
|
| 884 |
-
"### High SNR (~25 dB)\n"
|
| 885 |
-
"Speech with target IR and a quiet non-stationary interferer."
|
| 886 |
-
)
|
| 887 |
with gr.Row():
|
| 888 |
-
|
| 889 |
-
|
| 890 |
-
label="High SNR — example 1",
|
| 891 |
-
interactive=False,
|
| 892 |
-
)
|
| 893 |
-
gr.Audio(
|
| 894 |
-
value=_hi[1],
|
| 895 |
-
label="High SNR — example 2",
|
| 896 |
-
interactive=False,
|
| 897 |
-
)
|
| 898 |
|
| 899 |
-
gr.Markdown(
|
| 900 |
-
"### Low SNR (~2 dB)\n"
|
| 901 |
-
"Same layout as High SNR with a much louder interferer."
|
| 902 |
-
)
|
| 903 |
with gr.Row():
|
| 904 |
-
|
| 905 |
-
|
| 906 |
-
|
| 907 |
-
|
| 908 |
-
|
| 909 |
-
|
| 910 |
-
|
| 911 |
-
label="Low SNR — example 2",
|
| 912 |
-
interactive=False,
|
| 913 |
-
)
|
| 914 |
|
| 915 |
with gr.TabItem(tab_label("about", "About"), elem_id="about-tab", id=5):
|
| 916 |
gr.Markdown(ABOUT_TEXT, elem_classes="markdown-text")
|
|
|
|
| 846 |
|
| 847 |
with gr.TabItem(tab_label("examples", "Examples"), elem_id="examples-tab", id=4):
|
| 848 |
examples_renderer.ensure_assets()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 849 |
_dry = examples_renderer.sample_paths("dry")
|
| 850 |
_hi = examples_renderer.sample_paths("high_snr")
|
| 851 |
_lo = examples_renderer.sample_paths("low_snr")
|
| 852 |
_scene = examples_renderer.scene_image_path()
|
| 853 |
|
| 854 |
+
def _example_audio(path: str | None, label: str):
|
| 855 |
+
return gr.Audio(
|
| 856 |
+
value=path,
|
| 857 |
+
type="filepath",
|
| 858 |
+
label=label,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 859 |
interactive=False,
|
| 860 |
+
editable=False,
|
| 861 |
+
show_download_button=False,
|
| 862 |
+
show_share_button=False,
|
| 863 |
+
elem_classes="examples-audio",
|
| 864 |
)
|
| 865 |
+
|
| 866 |
+
with gr.Column(elem_classes="examples-scene-wrap"):
|
| 867 |
+
gr.Image(
|
| 868 |
+
value=_scene,
|
| 869 |
+
type="filepath",
|
| 870 |
+
label="Treble scene",
|
| 871 |
interactive=False,
|
| 872 |
+
show_label=False,
|
| 873 |
+
show_download_button=False,
|
| 874 |
+
show_fullscreen_button=False,
|
| 875 |
+
height=300,
|
| 876 |
+
container=False,
|
| 877 |
)
|
| 878 |
|
| 879 |
+
gr.Markdown("### Dry Speech")
|
|
|
|
|
|
|
|
|
|
| 880 |
with gr.Row():
|
| 881 |
+
_example_audio(_dry[0], "Example 1")
|
| 882 |
+
_example_audio(_dry[1], "Example 2")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 883 |
|
| 884 |
+
gr.Markdown("### High SNR")
|
|
|
|
|
|
|
|
|
|
| 885 |
with gr.Row():
|
| 886 |
+
_example_audio(_hi[0], "Example 1")
|
| 887 |
+
_example_audio(_hi[1], "Example 2")
|
| 888 |
+
|
| 889 |
+
gr.Markdown("### Low SNR")
|
| 890 |
+
with gr.Row():
|
| 891 |
+
_example_audio(_lo[0], "Example 1")
|
| 892 |
+
_example_audio(_lo[1], "Example 2")
|
|
|
|
|
|
|
|
|
|
| 893 |
|
| 894 |
with gr.TabItem(tab_label("about", "About"), elem_id="about-tab", id=5):
|
| 895 |
gr.Markdown(ABOUT_TEXT, elem_classes="markdown-text")
|
constants.py
CHANGED
|
@@ -384,6 +384,31 @@ footer { display: none !important; }
|
|
| 384 |
button.primary, .primary button {
|
| 385 |
font-weight: 600 !important;
|
| 386 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
""".replace("__TREBLE_TEAL__", TREBLE_TEAL).replace(
|
| 388 |
"__TREBLE_CYAN__", TREBLE_CYAN
|
| 389 |
).replace("__TREBLE_MINT__", TREBLE_MINT).replace(
|
|
|
|
| 384 |
button.primary, .primary button {
|
| 385 |
font-weight: 600 !important;
|
| 386 |
}
|
| 387 |
+
|
| 388 |
+
/* ---- Examples tab ---- */
|
| 389 |
+
#examples-tab .examples-scene-wrap .image-container,
|
| 390 |
+
#examples-tab .examples-scene-wrap .wrap {
|
| 391 |
+
max-height: 300px;
|
| 392 |
+
justify-content: center;
|
| 393 |
+
}
|
| 394 |
+
#examples-tab .examples-scene-wrap img {
|
| 395 |
+
object-fit: contain !important;
|
| 396 |
+
max-height: 300px;
|
| 397 |
+
width: auto !important;
|
| 398 |
+
max-width: 100%;
|
| 399 |
+
margin: 0 auto;
|
| 400 |
+
display: block;
|
| 401 |
+
}
|
| 402 |
+
#examples-tab .examples-scene-wrap {
|
| 403 |
+
max-width: 720px;
|
| 404 |
+
margin: 0 auto 0.5rem auto;
|
| 405 |
+
}
|
| 406 |
+
#examples-tab button.playback.icon {
|
| 407 |
+
display: none !important;
|
| 408 |
+
}
|
| 409 |
+
#examples-tab .examples-audio .icon-button-wrapper:has(button.playback) {
|
| 410 |
+
display: none !important;
|
| 411 |
+
}
|
| 412 |
""".replace("__TREBLE_TEAL__", TREBLE_TEAL).replace(
|
| 413 |
"__TREBLE_CYAN__", TREBLE_CYAN
|
| 414 |
).replace("__TREBLE_MINT__", TREBLE_MINT).replace(
|