KaiShin1885 commited on
Commit
57e4e8f
ยท
verified ยท
1 Parent(s): c34f6f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -1,20 +1,19 @@
1
- import gradio as gr
2
- from gtts import gTTS
3
  import os
 
 
4
 
5
- def text_to_speech(text, language):
6
  tts = gTTS(text=text, lang=language)
7
  tts.save("output.mp3")
8
- os.system("mpg321 output.mp3")
9
 
10
  iface = gr.Interface(
11
- fn=text_to_speech,
12
- inputs=["text", "select"],
13
  outputs="audio",
14
- title="ํ…์ŠคํŠธ ์Œ์„ฑ ๋ณ€ํ™˜",
15
- description="ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜๊ณ  ์–ธ์–ด๋ฅผ ์„ ํƒํ•˜์—ฌ ์Œ์„ฑ์„ ๋“ฃ์„ธ์š”",
16
- examples=[["์•ˆ๋…•ํ•˜์„ธ์š”, ์„ธ๊ณ„!", "ko"], ["Bonjour, monde!", "fr"]],
17
- allow_flagging="never"
18
  )
19
 
20
- iface.launch()
 
 
 
 
1
  import os
2
+ from gtts import gTTS
3
+ import gradio as gr
4
 
5
+ def texttospeech(text, language='ko'):
6
  tts = gTTS(text=text, lang=language)
7
  tts.save("output.mp3")
8
+ return "output.mp3"
9
 
10
  iface = gr.Interface(
11
+ fn=texttospeech,
12
+ inputs="text",
13
  outputs="audio",
14
+ title="GTTS ",
15
+ description=""
 
 
16
  )
17
 
18
+ if __name == "__main":
19
+ iface.launch()