Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,39 +1,21 @@
|
|
1 |
import gradio as gr
|
2 |
-
import
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
# This will depend on how the model's outputs are structured
|
19 |
-
# For now, let's assume you need a simple conversion to waveform/audio
|
20 |
-
|
21 |
-
# Placeholder: Assuming `outputs` contains audio data that can be returned directly as .wav format
|
22 |
-
# You might need to adjust this based on how the TTS model is structured and how it outputs speech
|
23 |
-
audio = outputs['logits'] # Adjust according to your model's output structure
|
24 |
-
|
25 |
-
# Return audio output (in numpy format) and the sample rate (this might be specific to your model)
|
26 |
-
return audio.numpy(), 22050 # Assuming the output is sampled at 22050 Hz
|
27 |
-
|
28 |
-
# Create Gradio interface
|
29 |
-
iface = gr.Interface(
|
30 |
-
fn=tts_generate,
|
31 |
-
inputs="text",
|
32 |
-
outputs="audio",
|
33 |
-
title="Bulgarian TTS (Text-to-Speech)",
|
34 |
-
description="Enter text to generate speech in Bulgarian."
|
35 |
)
|
36 |
|
37 |
-
#
|
38 |
-
|
39 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Hugging Face์์ TTS ํ์ดํ๋ผ์ธ ๋ก๋
|
5 |
+
tts = pipeline("text-to-speech", model="tts-model-name") # ์ ํฉํ ๋ถ๊ฐ๋ฆฌ์์ด TTS ๋ชจ๋ธ ์ด๋ฆ์ผ๋ก ๋์ฒด
|
6 |
+
|
7 |
+
def generate_audio(text):
|
8 |
+
audio = tts(text)
|
9 |
+
return audio["audio"]
|
10 |
+
|
11 |
+
# Gradio ์ธํฐํ์ด์ค ์์ฑ
|
12 |
+
interface = gr.Interface(
|
13 |
+
fn=generate_audio,
|
14 |
+
inputs=gr.Textbox(lines=5, label="๋ถ๊ฐ๋ฆฌ์์ด ํ
์คํธ ์
๋ ฅ"),
|
15 |
+
outputs=gr.Audio(label="์์ฑ๋ ์์ฑ"),
|
16 |
+
title="๋ถ๊ฐ๋ฆฌ์์ด TTS",
|
17 |
+
description="๋ถ๊ฐ๋ฆฌ์์ด ํ
์คํธ๋ฅผ ์
๋ ฅํ๋ฉด ์์ฑ์ผ๋ก ๋ณํํฉ๋๋ค."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
)
|
19 |
|
20 |
+
# ์น ์ฑ ์คํ
|
21 |
+
interface.launch()
|
|