Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import numpy as np
|
| 3 |
import re
|
| 4 |
import soundfile as sf
|
|
@@ -34,7 +35,7 @@ except Exception as e:
|
|
| 34 |
class LongFormTTS:
|
| 35 |
def __init__(self):
|
| 36 |
self.tts = tts
|
| 37 |
-
self.speakers = speakers
|
| 38 |
self.sample_rate = 22050 # Coqui default sample rate
|
| 39 |
|
| 40 |
def preprocess_text(self, text):
|
|
@@ -213,7 +214,11 @@ def create_interface():
|
|
| 213 |
info="Supports any length text with automatic chunking for optimal quality"
|
| 214 |
)
|
| 215 |
char_count = gr.HTML("<span style='color: #666;'>Character count: 0 / 50,000</span>")
|
| 216 |
-
speaker_dropdown = gr.Dropdown(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
generate_btn = gr.Button("🎯 Generate Speech", variant="primary", size="lg", scale=1)
|
| 218 |
with gr.Column(scale=1):
|
| 219 |
gr.HTML("""
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import torch
|
| 3 |
import numpy as np
|
| 4 |
import re
|
| 5 |
import soundfile as sf
|
|
|
|
| 35 |
class LongFormTTS:
|
| 36 |
def __init__(self):
|
| 37 |
self.tts = tts
|
| 38 |
+
self.speakers = speakers # Store available speakers
|
| 39 |
self.sample_rate = 22050 # Coqui default sample rate
|
| 40 |
|
| 41 |
def preprocess_text(self, text):
|
|
|
|
| 214 |
info="Supports any length text with automatic chunking for optimal quality"
|
| 215 |
)
|
| 216 |
char_count = gr.HTML("<span style='color: #666;'>Character count: 0 / 50,000</span>")
|
| 217 |
+
speaker_dropdown = gr.Dropdown(
|
| 218 |
+
choices=tts_system.speakers if tts_system else [],
|
| 219 |
+
value="p225" if tts_system else None,
|
| 220 |
+
label="🗣️ Choose Voice"
|
| 221 |
+
)
|
| 222 |
generate_btn = gr.Button("🎯 Generate Speech", variant="primary", size="lg", scale=1)
|
| 223 |
with gr.Column(scale=1):
|
| 224 |
gr.HTML("""
|