Spaces:
Sleeping
Sleeping
jinggujiwoo7
commited on
Commit
•
a8c79fb
1
Parent(s):
4124ee1
Update app.py
Browse files
app.py
CHANGED
@@ -20,9 +20,9 @@ def transcribe_audio(file_info):
|
|
20 |
except sr.RequestError as e:
|
21 |
return f"Could not request results; {e}"
|
22 |
|
23 |
-
def pronunciation_correction(
|
24 |
user_spoken_text = transcribe_audio(file_info)
|
25 |
-
similarity = ratio(
|
26 |
description = f"{similarity:.2f}"
|
27 |
|
28 |
if similarity >= 0.9:
|
@@ -36,7 +36,10 @@ def pronunciation_correction(sentence, file_info):
|
|
36 |
|
37 |
return feedback, description
|
38 |
|
39 |
-
|
|
|
|
|
|
|
40 |
audio_input = gr.inputs.Audio(label="Upload Audio File")
|
41 |
|
42 |
gr.Interface(pronunciation_correction,
|
|
|
20 |
except sr.RequestError as e:
|
21 |
return f"Could not request results; {e}"
|
22 |
|
23 |
+
def pronunciation_correction(expected_text, file_info):
|
24 |
user_spoken_text = transcribe_audio(file_info)
|
25 |
+
similarity = ratio(expected_text.lower(), user_spoken_text.lower())
|
26 |
description = f"{similarity:.2f}"
|
27 |
|
28 |
if similarity >= 0.9:
|
|
|
36 |
|
37 |
return feedback, description
|
38 |
|
39 |
+
def get_sentence():
|
40 |
+
return gr.inputs.Textbox(label="Enter a Sentence")
|
41 |
+
|
42 |
+
sentence_input = get_sentence()
|
43 |
audio_input = gr.inputs.Audio(label="Upload Audio File")
|
44 |
|
45 |
gr.Interface(pronunciation_correction,
|