kr / app.py
englissi's picture
Update app.py
df3d725 verified
raw
history blame contribute delete
682 Bytes
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()