ProPerNounpYK commited on
Commit
6f55b68
·
verified ·
1 Parent(s): e1e7ead

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+ from gtts import gTTS
4
+ import pygame
5
+
6
+ def text_to_speech(text):
7
+ tts = gTTS(text=text, lang="ko")
8
+ tts.save("output.mp3")
9
+ pygame.init()
10
+ pygame.mixer.music.load("output.mp3")
11
+ pygame.mixer.music.play()
12
+ while pygame.mixer.music.get_busy():
13
+ pygame.time.Clock().tick(10)
14
+
15
+ iface = gr.Interface(
16
+ fn=text_to_speech,
17
+ inputs="text",
18
+ outputs="audio",
19
+ title="GTTS 기반 한글 음성 변환",
20
+ description="텍스트를 음성으로 변환합니다."
21
+ )
22
+
23
+ iface.launch()