Yasir646 commited on
Commit
b875300
·
verified ·
1 Parent(s): 9d81572

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import streamlit as st
2
  from gtts import gTTS
3
  import os
4
- from playsound import playsound
5
 
6
  # App Title
7
  st.title("Text-to-Speech Streamlit App")
@@ -21,10 +20,10 @@ if st.button("Generate Speech"):
21
  # Save the generated speech to a file
22
  tts.save("output.mp3")
23
 
24
- # Play the speech
25
- playsound("output.mp3")
26
 
27
  # Display success message
28
- st.success("Speech has been generated and played successfully.")
29
  else:
30
  st.warning("Please enter some text.")
 
1
  import streamlit as st
2
  from gtts import gTTS
3
  import os
 
4
 
5
  # App Title
6
  st.title("Text-to-Speech Streamlit App")
 
20
  # Save the generated speech to a file
21
  tts.save("output.mp3")
22
 
23
+ # Provide a download link for the audio file
24
+ st.audio("output.mp3", format='audio/mp3')
25
 
26
  # Display success message
27
+ st.success("Speech has been generated. You can listen to it above or download the file.")
28
  else:
29
  st.warning("Please enter some text.")