Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.py +22 -0
- 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
|