abaliyan commited on
Commit
c8c9b15
·
verified ·
1 Parent(s): d7403d7

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from utils import *
3
+ import io
4
+
5
+
6
+
7
+ def main():
8
+ st.header('Welcome to the app')
9
+
10
+
11
+ mode = st.selectbox(label='select one', options=['Text-to-speech','Speech-to-text'])
12
+
13
+ if mode == 'Text-to-speech':
14
+ # st.write("calling text to speech function")
15
+ input_text = st.text_area("Enter the text here..")
16
+ if st.button("Generate Audio") and input_text:
17
+ response = text_to_speech(input_text)
18
+ if response:
19
+ st.audio(io.BytesIO(response.content))
20
+ elif mode == 'Speech-to-text':
21
+ # st.write('calling speech to text function')
22
+ audio_uploaded = st.file_uploader("Upload your file", type='.mp3')
23
+ if st.button("Generate transcript") and audio_uploaded:
24
+ text = audio_to_text(audio_uploaded)
25
+ st.write(text)
26
+
27
+
28
+ if __name__ == '__main__':
29
+ main()