Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -102,15 +102,14 @@ try:
|
|
102 |
str_left_to_right += convert_to_braille_unicode(model.names[int(each_class)])
|
103 |
result += str_left_to_right + "\n"
|
104 |
st.write(str_left_to_right)
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
os.makedirs(AUDIO_OUTPUT_FOLDER, exist_ok=True)
|
109 |
|
110 |
def text_to_speech_gtts(text, lang='en', filename="output.mp3"):
|
111 |
"""将文本转换为语音并保存音频文件"""
|
112 |
tts = gTTS(text=text, lang=lang)
|
113 |
-
audio_path =
|
114 |
tts.save(audio_path)
|
115 |
return audio_path
|
116 |
|
|
|
102 |
str_left_to_right += convert_to_braille_unicode(model.names[int(each_class)])
|
103 |
result += str_left_to_right + "\n"
|
104 |
st.write(str_left_to_right)
|
105 |
+
|
106 |
+
except Exception as ex:
|
107 |
+
st.write("An error occurred while processing the audio.")
|
|
|
108 |
|
109 |
def text_to_speech_gtts(text, lang='en', filename="output.mp3"):
|
110 |
"""将文本转换为语音并保存音频文件"""
|
111 |
tts = gTTS(text=text, lang=lang)
|
112 |
+
audio_path = "./output_audio"
|
113 |
tts.save(audio_path)
|
114 |
return audio_path
|
115 |
|