broadfield-dev commited on
Commit
b65bc22
·
verified ·
1 Parent(s): 41b4340

Adding file test: app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -1,17 +1,21 @@
1
  import gradio as gr
2
  from gtts import gTTS
 
3
 
4
- def text_to_speech(text):
5
- tts = gTTS(text=text, lang='en')
6
  tts.save("output.mp3")
7
  return "output.mp3"
8
 
9
  iface = gr.Interface(
10
  fn=text_to_speech,
11
- inputs="text",
 
 
 
12
  outputs="audio",
13
  title="Text to Speech Converter",
14
- description="Enter text in the box below and click 'Submit' to convert it to speech."
15
  )
16
 
17
  iface.launch()
 
1
  import gradio as gr
2
  from gtts import gTTS
3
+ import os
4
 
5
+ def text_to_speech(text, lang):
6
+ tts = gTTS(text=text, lang=lang)
7
  tts.save("output.mp3")
8
  return "output.mp3"
9
 
10
  iface = gr.Interface(
11
  fn=text_to_speech,
12
+ inputs=[
13
+ gr.inputs.Textbox(lines=2, placeholder="Enter text here..."),
14
+ gr.inputs.Dropdown(choices=["en", "es", "fr", "de", "it"], label="Language", default="en")
15
+ ],
16
  outputs="audio",
17
  title="Text to Speech Converter",
18
+ description="Convert your text to speech in multiple languages using this simple Gradio demo."
19
  )
20
 
21
  iface.launch()