coraKong commited on
Commit
c962c9a
1 Parent(s): 117120f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from TTS.api import TTS
3
+
4
+ # List available 🐸TTS models and choose the first one
5
+ model_name = TTS.list_models()[0]
6
+ # Init TTS
7
+ tts = TTS(model_name)
8
+
9
+ def text_to_speech(text: str, speaker_wav, language: str):
10
+ tts.tts_to_file(text, speaker_wav=speaker_wav, language=language, file_path="output.wav")
11
+ # tts.tts_to_file(text=text, speaker=tts.speakers[0], language=language, file_path="output.wav")
12
+ return 'output.wav'
13
+
14
+ inputs = [gr.Textbox(label="Input", value="Personalized learning platform for students with learning differences: You could develop an AI-powered platform that uses adaptive learning algorithms to provide personalized learning experiences for students with learning differences such as dyslexia or ADHD. As a front-end developer, you could design and develop the user interface, while your background in psychology could inform the adaptive learning algorithms used by the platform.", max_lines=3),
15
+ gr.Audio(Lable="Speaker Wav", source="microphone", type="filepath"),
16
+ gr.Radio(label="Language", choices=tts.languages, value="en")]
17
+ outputs = gr.Audio(label="Output")
18
+
19
+ demo = gr.Interface(fn=text_to_speech, inputs=inputs, outputs=outputs)
20
+
21
+ demo.launch(debug=True)