Spaces:
Running
Running
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() | |