Spaces:
Runtime error
Runtime error
Make audio file directory creation automatic
Browse files
app.py
CHANGED
@@ -19,7 +19,10 @@ def load_model():
|
|
19 |
|
20 |
def save_file(sound_file):
|
21 |
# save your sound file in the right folder by following the path
|
22 |
-
|
|
|
|
|
|
|
23 |
f.write(sound_file.getbuffer())
|
24 |
return sound_file.name
|
25 |
|
@@ -55,7 +58,7 @@ def mispronounciation_detection_section():
|
|
55 |
raw_info = mispronunciation_detector.detect(audio, text)
|
56 |
|
57 |
st.write('#### Phoneme Level Analysis')
|
58 |
-
st.
|
59 |
# enable horizontal scrolling for phoneme output
|
60 |
#st.text_area(label="Aligned phoneme outputs", value=raw_info['phoneme_output'],height=150)
|
61 |
st.markdown(
|
@@ -83,7 +86,7 @@ def mispronounciation_detection_section():
|
|
83 |
md.append(word)
|
84 |
|
85 |
st.write('#### Word Level Analysis')
|
86 |
-
st.write(f"Word Error Rate:
|
87 |
st.markdown(" ".join(md))
|
88 |
else:
|
89 |
st.error('The audio or text has not been properly input', icon="🚨")
|
|
|
19 |
|
20 |
def save_file(sound_file):
|
21 |
# save your sound file in the right folder by following the path
|
22 |
+
audio_folder_path = os.path.join(os.getcwd(), 'audio_files')
|
23 |
+
if not os.path.exists(audio_folder_path):
|
24 |
+
os.makedirs(audio_folder_path)
|
25 |
+
with open(os.path.join(audio_folder_path, sound_file.name), 'wb') as f:
|
26 |
f.write(sound_file.getbuffer())
|
27 |
return sound_file.name
|
28 |
|
|
|
58 |
raw_info = mispronunciation_detector.detect(audio, text)
|
59 |
|
60 |
st.write('#### Phoneme Level Analysis')
|
61 |
+
st.write(f"Phoneme Error Rate: {round(raw_info['per'],2)}")
|
62 |
# enable horizontal scrolling for phoneme output
|
63 |
#st.text_area(label="Aligned phoneme outputs", value=raw_info['phoneme_output'],height=150)
|
64 |
st.markdown(
|
|
|
86 |
md.append(word)
|
87 |
|
88 |
st.write('#### Word Level Analysis')
|
89 |
+
st.write(f"Word Error Rate: {round(raw_info['wer'], 2)} and the following words in bold have errors:")
|
90 |
st.markdown(" ".join(md))
|
91 |
else:
|
92 |
st.error('The audio or text has not been properly input', icon="🚨")
|