Create app.py
Browse files
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()
|