Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
|
|
| 1 |
import os
|
| 2 |
from gtts import gTTS
|
| 3 |
-
import
|
| 4 |
|
| 5 |
-
def
|
| 6 |
-
|
|
|
|
|
|
|
| 7 |
tts.save("output.mp3")
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
iface = gr.Interface(
|
| 11 |
-
fn=
|
| 12 |
inputs="text",
|
| 13 |
outputs="audio",
|
| 14 |
-
title="GTTS ",
|
| 15 |
-
description=""
|
| 16 |
)
|
| 17 |
|
| 18 |
-
|
| 19 |
-
iface.launch()
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
import os
|
| 3 |
from gtts import gTTS
|
| 4 |
+
import pygame
|
| 5 |
|
| 6 |
+
def text_to_speech(text):
|
| 7 |
+
pygame.init()
|
| 8 |
+
pygame.mixer.init()
|
| 9 |
+
tts = gTTS(text=text, lang="ko")
|
| 10 |
tts.save("output.mp3")
|
| 11 |
+
pygame.mixer.music.load("output.mp3")
|
| 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=text_to_speech,
|
| 18 |
inputs="text",
|
| 19 |
outputs="audio",
|
| 20 |
+
title="GTTS 기반 한글 음성 변환",
|
| 21 |
+
description="텍스트를 음성으로 변환합니다."
|
| 22 |
)
|
| 23 |
|
| 24 |
+
iface.launch()
|
|
|