englissi commited on
Commit
a8cd458
ยท
verified ยท
1 Parent(s): 49acfd9

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gtts import gTTS
3
+ import os
4
+
5
+ # TTS ๋ณ€ํ™˜ ํ•จ์ˆ˜
6
+ def text_to_speech_korean(text):
7
+ # gTTS๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ…์ŠคํŠธ๋ฅผ ํ•œ๊ตญ์–ด๋กœ ๋ณ€ํ™˜
8
+ tts = gTTS(text, lang='ko')
9
+ # ์ถœ๋ ฅํ•  ์˜ค๋””์˜ค ํŒŒ์ผ ์ด๋ฆ„ ์„ค์ •
10
+ output_path = "output.mp3"
11
+ tts.save(output_path)
12
+ return output_path
13
+
14
+ # Gradio ์ธํ„ฐํŽ˜์ด์Šค ์„ค์ •
15
+ iface = gr.Interface(
16
+ fn=text_to_speech_korean,
17
+ inputs=gr.inputs.Textbox(label="ํ•œ๊ตญ์–ด ํ…์ŠคํŠธ ์ž…๋ ฅ"),
18
+ outputs=gr.outputs.Audio(type="file", label="TTS ์ถœ๋ ฅ"),
19
+ title="ํ•œ๊ตญ์–ด TTS",
20
+ description="ํ•œ๊ตญ์–ด ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜๋ฉด TTS๋กœ ์Œ์„ฑ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค."
21
+ )
22
+
23
+ # ์ธํ„ฐํŽ˜์ด์Šค ์‹คํ–‰
24
+ iface.launch()