File size: 682 Bytes
a8cd458
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1592f6a
8137884
a8cd458
 
 
 
 
df3d725
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from gtts import gTTS
import os

# TTS ๋ณ€ํ™˜ ํ•จ์ˆ˜
def text_to_speech_korean(text):
    # gTTS๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ…์ŠคํŠธ๋ฅผ ํ•œ๊ตญ์–ด๋กœ ๋ณ€ํ™˜
    tts = gTTS(text, lang='ko')
    # ์ถœ๋ ฅํ•  ์˜ค๋””์˜ค ํŒŒ์ผ ์ด๋ฆ„ ์„ค์ •
    output_path = "output.mp3"
    tts.save(output_path)
    return output_path

# Gradio ์ธํ„ฐํŽ˜์ด์Šค ์„ค์ •
iface = gr.Interface(
    fn=text_to_speech_korean,
    inputs=gr.Textbox(label="ํ•œ๊ตญ์–ด ํ…์ŠคํŠธ ์ž…๋ ฅ"),
    outputs=gr.Audio(type="filepath", label="TTS ์ถœ๋ ฅ"),
    title="ํ•œ๊ตญ์–ด TTS",
    description="ํ•œ๊ตญ์–ด ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜๋ฉด TTS๋กœ ์Œ์„ฑ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค."
)

# ์ธํ„ฐํŽ˜์ด์Šค ์‹คํ–‰
iface.launch()