sarahai commited on
Commit
e6adf01
1 Parent(s): 914b4d2

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +22 -0
  2. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from gtts import gTTS
3
+ from io import BytesIO
4
+
5
+
6
+ st.title("Simple Text to Speech Converter")
7
+
8
+ text_input = st.text_area("Enter text to convert to speech")
9
+
10
+ language = st.selectbox("Select language",["en","fr","ru","hi","es"])
11
+
12
+ if st.button("Generate my speech"):
13
+ if text_input:
14
+ tts = gTTS(text_input, lang=language)
15
+
16
+ audio_stream = BytesIO()
17
+
18
+ tts.write_to_fp(audio_stream)
19
+
20
+ st.audio(audio_stream)
21
+ else:
22
+ st.warning("Please enter some text.")
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ streamlit
2
+ gtts
3
+ IPython