bgtts / app.py
englissi's picture
Update app.py
dac6347 verified
raw
history blame
661 Bytes
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()