Spaces:
Running
Running
alessandro trinca tornidor
commited on
Commit
·
290bfe0
1
Parent(s):
ce5c4e6
feat: rename some labels
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ css = """
|
|
12 |
.speech-output-container {min-height: 60px;}
|
13 |
.speech-output-html {text-align: left; }
|
14 |
"""
|
15 |
-
word_idx_text = "
|
16 |
|
17 |
|
18 |
def get_textbox_hidden():
|
@@ -71,14 +71,14 @@ with gr.Blocks(css=css, head=js.head_driver_tour) as gradio_app:
|
|
71 |
btn_clear_tts.click(clear, inputs=[], outputs=[audio_tts])
|
72 |
with gr.Row():
|
73 |
audio_student_recording_stt = gr.Audio(
|
74 |
-
label="
|
75 |
sources=["microphone", "upload"],
|
76 |
type="filepath",
|
77 |
show_download_button=True,
|
78 |
elem_id="audio-student-recording-stt-id-element",
|
79 |
)
|
80 |
with gr.Row():
|
81 |
-
with gr.Accordion("Click here to expand the table examples", open=
|
82 |
examples_text = gr.Examples(
|
83 |
examples=[
|
84 |
["Hallo, wie geht es dir?", "de", 1],
|
@@ -129,12 +129,12 @@ with gr.Blocks(css=css, head=js.head_driver_tour) as gradio_app:
|
|
129 |
btn_recognize_speech_accuracy = gr.Button(value="Get speech accuracy score (%)", elem_id="btn-recognize-speech-accuracy-id-element")
|
130 |
with gr.Row():
|
131 |
num_tot_recognized_words = gr.Number(label="Total recognized words", visible=False, minimum=0, interactive=False)
|
132 |
-
with gr.Column(scale=
|
133 |
num_selected_recognized_words = gr.Number(label=word_idx_text, visible=True, minimum=0, value=0, interactive=False)
|
134 |
-
with gr.Column(scale=
|
135 |
# todo: use https://www.gradio.app/docs/gradio/multimodaltextbox
|
136 |
audio_splitted_student_recording_stt = gr.Audio(
|
137 |
-
label="Splitted student
|
138 |
type="filepath",
|
139 |
show_download_button=True,
|
140 |
elem_id="audio-splitted-student-recording-stt-id-element",
|
@@ -196,7 +196,7 @@ with gr.Blocks(css=css, head=js.head_driver_tour) as gradio_app:
|
|
196 |
app_logger.info(f"change_max_selected_words: {n} ...")
|
197 |
num_max_selected_words = n -1
|
198 |
app_logger.info(f"num_selected_recognized_words.maximum, pre: {num_selected_recognized_words.maximum} ...")
|
199 |
-
label = word_idx_text if n == 0 else f"{word_idx_text} ({num_max_selected_words}
|
200 |
interactive = n > 0
|
201 |
app_logger.info(f"change_max_selected_words: {n}, is interactive? {interactive} ...")
|
202 |
new_num_selected_recognized_words = gr.Number(label=label, visible=True, value=0, minimum=0, maximum=num_max_selected_words, interactive=interactive)
|
|
|
12 |
.speech-output-container {min-height: 60px;}
|
13 |
.speech-output-html {text-align: left; }
|
14 |
"""
|
15 |
+
word_idx_text = "Selected word index"
|
16 |
|
17 |
|
18 |
def get_textbox_hidden():
|
|
|
71 |
btn_clear_tts.click(clear, inputs=[], outputs=[audio_tts])
|
72 |
with gr.Row():
|
73 |
audio_student_recording_stt = gr.Audio(
|
74 |
+
label="Record a speech to evaluate",
|
75 |
sources=["microphone", "upload"],
|
76 |
type="filepath",
|
77 |
show_download_button=True,
|
78 |
elem_id="audio-student-recording-stt-id-element",
|
79 |
)
|
80 |
with gr.Row():
|
81 |
+
with gr.Accordion("Click here to expand the table examples", open=False, elem_id="accordion-examples-id-element"):
|
82 |
examples_text = gr.Examples(
|
83 |
examples=[
|
84 |
["Hallo, wie geht es dir?", "de", 1],
|
|
|
129 |
btn_recognize_speech_accuracy = gr.Button(value="Get speech accuracy score (%)", elem_id="btn-recognize-speech-accuracy-id-element")
|
130 |
with gr.Row():
|
131 |
num_tot_recognized_words = gr.Number(label="Total recognized words", visible=False, minimum=0, interactive=False)
|
132 |
+
with gr.Column(scale=1, min_width=50):
|
133 |
num_selected_recognized_words = gr.Number(label=word_idx_text, visible=True, minimum=0, value=0, interactive=False)
|
134 |
+
with gr.Column(scale=4, min_width=100):
|
135 |
# todo: use https://www.gradio.app/docs/gradio/multimodaltextbox
|
136 |
audio_splitted_student_recording_stt = gr.Audio(
|
137 |
+
label="Splitted student speech output",
|
138 |
type="filepath",
|
139 |
show_download_button=True,
|
140 |
elem_id="audio-splitted-student-recording-stt-id-element",
|
|
|
196 |
app_logger.info(f"change_max_selected_words: {n} ...")
|
197 |
num_max_selected_words = n -1
|
198 |
app_logger.info(f"num_selected_recognized_words.maximum, pre: {num_selected_recognized_words.maximum} ...")
|
199 |
+
label = word_idx_text if n == 0 else f"{word_idx_text} (from 0 to {num_max_selected_words})"
|
200 |
interactive = n > 0
|
201 |
app_logger.info(f"change_max_selected_words: {n}, is interactive? {interactive} ...")
|
202 |
new_num_selected_recognized_words = gr.Number(label=label, visible=True, value=0, minimum=0, maximum=num_max_selected_words, interactive=interactive)
|