Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,24 +1,19 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
import os
|
| 3 |
from gtts import gTTS
|
| 4 |
-
import
|
| 5 |
|
| 6 |
-
def
|
| 7 |
-
|
| 8 |
-
pygame.mixer.init() # pygame mixer 초기화
|
| 9 |
-
tts = gTTS(text=text, lang="ko")
|
| 10 |
tts.save("output.mp3")
|
| 11 |
-
|
| 12 |
-
pygame.mixer.music.play()
|
| 13 |
-
while pygame.mixer.music.get_busy():
|
| 14 |
-
pygame.time.Clock().tick(10)
|
| 15 |
|
| 16 |
iface = gr.Interface(
|
| 17 |
-
fn=
|
| 18 |
inputs="text",
|
| 19 |
outputs="audio",
|
| 20 |
-
title="GTTS
|
| 21 |
-
description="
|
| 22 |
)
|
| 23 |
|
| 24 |
-
|
|
|
|
|
|
|
|
|
| 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()
|