Abdurahman
commited on
Commit
·
fe67771
1
Parent(s):
6b61ee0
app
Browse files
app.py
CHANGED
@@ -27,9 +27,9 @@ with gr.Blocks() as app:
|
|
27 |
generate_long_btn = gr.Button("Generate Long Text")
|
28 |
with gr.Group():
|
29 |
with gr.Row():
|
30 |
-
example_audio = gr.Audio(label="3. Click \"Generate
|
31 |
with gr.Row():
|
32 |
-
tts_btn = gr.Button("Generate
|
33 |
with gr.Group():
|
34 |
with gr.Row():
|
35 |
user_audio = gr.Audio(
|
@@ -55,15 +55,15 @@ with gr.Blocks() as app:
|
|
55 |
placeholder="ASR transcription of user audio..."
|
56 |
)
|
57 |
|
58 |
-
# Group
|
59 |
with gr.Group():
|
60 |
with gr.Row():
|
61 |
-
|
62 |
-
label="
|
63 |
-
placeholder="IPA representation of the
|
64 |
)
|
65 |
with gr.Row():
|
66 |
-
|
67 |
label="User Phonemes",
|
68 |
placeholder="IPA representation of the user pronunciation..."
|
69 |
)
|
@@ -76,7 +76,7 @@ with gr.Blocks() as app:
|
|
76 |
)
|
77 |
with gr.Row():
|
78 |
match_box = gr.Markdown(
|
79 |
-
label="
|
80 |
value="Matching and mismatched characters visualized here..."
|
81 |
)
|
82 |
|
@@ -102,7 +102,7 @@ with gr.Blocks() as app:
|
|
102 |
check_btn.click(
|
103 |
asr.check_pronunciation,
|
104 |
inputs=[input_text, script_choice, user_audio],
|
105 |
-
outputs=[transcript_ugArab_box, transcript_ugLatn_box,
|
106 |
)
|
107 |
|
108 |
# Main
|
|
|
27 |
generate_long_btn = gr.Button("Generate Long Text")
|
28 |
with gr.Group():
|
29 |
with gr.Row():
|
30 |
+
example_audio = gr.Audio(label="3. (Optional) Click \"Generate AI Pronunciation\"")
|
31 |
with gr.Row():
|
32 |
+
tts_btn = gr.Button("Generate AI Pronunciation")
|
33 |
with gr.Group():
|
34 |
with gr.Row():
|
35 |
user_audio = gr.Audio(
|
|
|
55 |
placeholder="ASR transcription of user audio..."
|
56 |
)
|
57 |
|
58 |
+
# Group AI and user pronunciation
|
59 |
with gr.Group():
|
60 |
with gr.Row():
|
61 |
+
correct_phoneme_box = gr.Textbox(
|
62 |
+
label="Correct Phonemes",
|
63 |
+
placeholder="IPA representation of the Correct pronunciation..."
|
64 |
)
|
65 |
with gr.Row():
|
66 |
+
user_phoneme_box = gr.Textbox(
|
67 |
label="User Phonemes",
|
68 |
placeholder="IPA representation of the user pronunciation..."
|
69 |
)
|
|
|
76 |
)
|
77 |
with gr.Row():
|
78 |
match_box = gr.Markdown(
|
79 |
+
label="Pronunciation Feedback",
|
80 |
value="Matching and mismatched characters visualized here..."
|
81 |
)
|
82 |
|
|
|
102 |
check_btn.click(
|
103 |
asr.check_pronunciation,
|
104 |
inputs=[input_text, script_choice, user_audio],
|
105 |
+
outputs=[transcript_ugArab_box, transcript_ugLatn_box, correct_phoneme_box, user_phoneme_box, match_box, score_box]
|
106 |
)
|
107 |
|
108 |
# Main
|
asr.py
CHANGED
@@ -48,9 +48,9 @@ def check_pronunciation(input_text, script, user_audio):
|
|
48 |
transcript_ugArab_box = util.ug_latn_to_arab(transcript_ugLatn_box)
|
49 |
|
50 |
# Get IPA and Pronunciation Feedback
|
51 |
-
|
52 |
reference_text = input_text,
|
53 |
output_text = transcript_ugArab_box,
|
54 |
script=script)
|
55 |
|
56 |
-
return transcript_ugArab_box, transcript_ugLatn_box,
|
|
|
48 |
transcript_ugArab_box = util.ug_latn_to_arab(transcript_ugLatn_box)
|
49 |
|
50 |
# Get IPA and Pronunciation Feedback
|
51 |
+
correct_phoneme, user_phoneme, pronunciation_match, pronunciation_score = util.calculate_pronunciation_accuracy(
|
52 |
reference_text = input_text,
|
53 |
output_text = transcript_ugArab_box,
|
54 |
script=script)
|
55 |
|
56 |
+
return transcript_ugArab_box, transcript_ugLatn_box, correct_phoneme, user_phoneme, pronunciation_match, pronunciation_score
|