Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -12,6 +12,7 @@ embeddings_dataset = load_dataset("umarigan/turkish_voice_dataset_embedded", spl
|
|
12 |
|
13 |
# Define the speech generation function
|
14 |
def generate_speech(text):
|
|
|
15 |
speaker_embedding = torch.tensor(embeddings_dataset[768]["speaker_embeddings"]).unsqueeze(0)
|
16 |
speech = synthesiser(text, forward_params={"speaker_embeddings": speaker_embedding})
|
17 |
|
@@ -23,12 +24,35 @@ def generate_speech(text):
|
|
23 |
|
24 |
# Define the Gradio interface
|
25 |
inputs = [
|
26 |
-
gr.Textbox(label="Enter Text", placeholder="Bir berber bir berbere gel beraber bir berber kuralım demiş"),
|
27 |
-
#gr.Number(label="Speaker ID", value=736, precision=0)
|
28 |
]
|
29 |
|
30 |
-
outputs = gr.Audio(label="Generated Speech")
|
31 |
|
32 |
-
|
|
|
|
|
|
|
|
|
33 |
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# Define the speech generation function
|
14 |
def generate_speech(text):
|
15 |
+
# Use a pre-defined speaker embedding from the dataset
|
16 |
speaker_embedding = torch.tensor(embeddings_dataset[768]["speaker_embeddings"]).unsqueeze(0)
|
17 |
speech = synthesiser(text, forward_params={"speaker_embeddings": speaker_embedding})
|
18 |
|
|
|
24 |
|
25 |
# Define the Gradio interface
|
26 |
inputs = [
|
27 |
+
gr.Textbox(label="📝 Enter Text", placeholder="Bir berber bir berbere gel beraber bir berber kuralım demiş", lines=3),
|
|
|
28 |
]
|
29 |
|
30 |
+
outputs = gr.Audio(label="🎤 Generated Speech")
|
31 |
|
32 |
+
# Additional elements to include information and style
|
33 |
+
title = "🎙️ Turkish Text-to-Speech with Fine-Tuned TTS Model"
|
34 |
+
description = """
|
35 |
+
Welcome to the **Turkish Text-to-Speech** app! 🌟 This model is a fine-tuned version of Microsoft's SpeechT5, trained on a large Turkish dataset with over 20k audio samples.
|
36 |
+
It helps generate natural-sounding speech from text input in **Turkish**! 🇹🇷
|
37 |
|
38 |
+
**Use Cases**:
|
39 |
+
- Easily generate **custom speech datasets**.
|
40 |
+
- Automate **text-to-speech pipelines** for various applications with low cost and efficiency. 💡
|
41 |
+
|
42 |
+
Check out the model on [Hugging Face](https://huggingface.co/umarigan/speecht5_tts_tr_v1.0)
|
43 |
+
"""
|
44 |
+
|
45 |
+
footer = """
|
46 |
+
💻 Connect with me on [X](https://x.com/Umar26338572e) 🐦
|
47 |
+
"""
|
48 |
+
|
49 |
+
# Create the Gradio app interface
|
50 |
+
gr.Interface(
|
51 |
+
fn=generate_speech,
|
52 |
+
inputs=inputs,
|
53 |
+
outputs=outputs,
|
54 |
+
title=title,
|
55 |
+
description=description,
|
56 |
+
article=footer,
|
57 |
+
theme="compact", # Choose a theme that matches the colorful aesthetic
|
58 |
+
).launch()
|