File size: 661 Bytes
6a81069
dac6347
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8d444a7
6a81069
dac6347
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from transformers import pipeline

# Hugging Face์—์„œ TTS ํŒŒ์ดํ”„๋ผ์ธ ๋กœ๋“œ
tts = pipeline("text-to-speech", model="tts-model-name")  # ์ ํ•ฉํ•œ ๋ถˆ๊ฐ€๋ฆฌ์•„์–ด TTS ๋ชจ๋ธ ์ด๋ฆ„์œผ๋กœ ๋Œ€์ฒด

def generate_audio(text):
    audio = tts(text)
    return audio["audio"]

# Gradio ์ธํ„ฐํŽ˜์ด์Šค ์ƒ์„ฑ
interface = gr.Interface(
    fn=generate_audio,
    inputs=gr.Textbox(lines=5, label="๋ถˆ๊ฐ€๋ฆฌ์•„์–ด ํ…์ŠคํŠธ ์ž…๋ ฅ"),
    outputs=gr.Audio(label="์ƒ์„ฑ๋œ ์Œ์„ฑ"),
    title="๋ถˆ๊ฐ€๋ฆฌ์•„์–ด TTS",
    description="๋ถˆ๊ฐ€๋ฆฌ์•„์–ด ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ์Œ์„ฑ์œผ๋กœ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค."
)

# ์›น ์•ฑ ์‹คํ–‰
interface.launch()