Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -62,7 +62,7 @@ col1, col2 = st.columns(2)
|
|
62 |
# left column of the page body
|
63 |
with col1:
|
64 |
if source_img is None:
|
65 |
-
default_image_path =
|
66 |
image = load_image(default_image_path)
|
67 |
st.image(
|
68 |
default_image_path, caption="Example Input Image", use_column_width=True
|
@@ -107,9 +107,9 @@ def text_to_speech_gtts(text, lang='en'):
|
|
107 |
# 将文本转换为语音
|
108 |
tts = gTTS(text=text, lang=lang)
|
109 |
# 保存音频文件
|
110 |
-
tts.save(
|
111 |
|
112 |
-
audio_file_path =
|
113 |
|
114 |
text_to_speech_gtts(result)
|
115 |
|
@@ -126,7 +126,7 @@ def play_mp3(file_path):
|
|
126 |
continue
|
127 |
|
128 |
# 调用函数,播放 MP3 文件
|
129 |
-
play_mp3("
|
130 |
|
131 |
|
132 |
except Exception as ex:
|
|
|
62 |
# left column of the page body
|
63 |
with col1:
|
64 |
if source_img is None:
|
65 |
+
default_image_path = "./image/test_1.jpg"
|
66 |
image = load_image(default_image_path)
|
67 |
st.image(
|
68 |
default_image_path, caption="Example Input Image", use_column_width=True
|
|
|
107 |
# 将文本转换为语音
|
108 |
tts = gTTS(text=text, lang=lang)
|
109 |
# 保存音频文件
|
110 |
+
tts.save("./output_audio/output.mp3")
|
111 |
|
112 |
+
audio_file_path = "./output_audio/output.mp3"
|
113 |
|
114 |
text_to_speech_gtts(result)
|
115 |
|
|
|
126 |
continue
|
127 |
|
128 |
# 调用函数,播放 MP3 文件
|
129 |
+
play_mp3("./output_audio/output.mp3")
|
130 |
|
131 |
|
132 |
except Exception as ex:
|