Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -86,17 +86,16 @@ def text_to_speech(text, speed=1.3):
|
|
86 |
modified_audio_fp.seek(0)
|
87 |
return modified_audio_fp
|
88 |
|
89 |
-
def audio_play(
|
90 |
-
|
|
|
|
|
91 |
|
92 |
def display_recognition_result(audio_text, output, audio_file):
|
93 |
if audio_text:
|
94 |
st.session_state.history.append((audio_text, output))
|
95 |
|
96 |
-
|
97 |
-
st.markdown(
|
98 |
-
f"""<audio autoplay="autoplay" controls="controls" src="data:audio/mp3;base64,{base64.b64encode(audio_file.read()).decode()}" type="audio/mp3" id="audio_player"></audio>""",
|
99 |
-
unsafe_allow_html=True)
|
100 |
|
101 |
def main():
|
102 |
if not st.session_state.pre_prompt_sent:
|
|
|
86 |
modified_audio_fp.seek(0)
|
87 |
return modified_audio_fp
|
88 |
|
89 |
+
def audio_play(audio_file):
|
90 |
+
if audio_file is not None:
|
91 |
+
audio_binary = audio_file.export(format="mp3").read()
|
92 |
+
st.audio(audio_binary, format="audio/mp3", start_time=0)
|
93 |
|
94 |
def display_recognition_result(audio_text, output, audio_file):
|
95 |
if audio_text:
|
96 |
st.session_state.history.append((audio_text, output))
|
97 |
|
98 |
+
audio_play(audio_file)
|
|
|
|
|
|
|
99 |
|
100 |
def main():
|
101 |
if not st.session_state.pre_prompt_sent:
|