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() |