Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import torch
|
| 3 |
import numpy as np
|
| 4 |
import re
|
| 5 |
import soundfile as sf
|
|
@@ -55,6 +54,7 @@ class LongFormTTS:
|
|
| 55 |
text = re.sub(r'\b(\d{1,4})\b', lambda m: self.number_to_words(int(m.group())), text)
|
| 56 |
text = re.sub(r'\b(1[0-9]{3}|20[0-9]{2}|2100)\b', lambda m: m.group(), text)
|
| 57 |
text = re.sub(r'[^\w\s\.,!?;:\-\(\)\'"]', ' ', text)
|
|
|
|
| 58 |
return text.strip()
|
| 59 |
|
| 60 |
def number_to_words(self, num):
|
|
@@ -187,7 +187,7 @@ def create_interface():
|
|
| 187 |
gr.HTML("""
|
| 188 |
<div class="main-header">
|
| 189 |
<h1>🎤 Long-Form Text-to-Speech Generator</h1>
|
| 190 |
-
<p style="color: #666; font-size: 1.1em;">Choose a voice and transform any text into expressive human-like speech</p>
|
| 191 |
</div>
|
| 192 |
""")
|
| 193 |
if tts_system:
|
|
@@ -216,7 +216,7 @@ def create_interface():
|
|
| 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=
|
| 220 |
label="🗣️ Choose Voice"
|
| 221 |
)
|
| 222 |
generate_btn = gr.Button("🎯 Generate Speech", variant="primary", size="lg", scale=1)
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import numpy as np
|
| 3 |
import re
|
| 4 |
import soundfile as sf
|
|
|
|
| 54 |
text = re.sub(r'\b(\d{1,4})\b', lambda m: self.number_to_words(int(m.group())), text)
|
| 55 |
text = re.sub(r'\b(1[0-9]{3}|20[0-9]{2}|2100)\b', lambda m: m.group(), text)
|
| 56 |
text = re.sub(r'[^\w\s\.,!?;:\-\(\)\'"]', ' ', text)
|
| 57 |
+
text = re.sub(r'\s+', ' ', text)
|
| 58 |
return text.strip()
|
| 59 |
|
| 60 |
def number_to_words(self, num):
|
|
|
|
| 187 |
gr.HTML("""
|
| 188 |
<div class="main-header">
|
| 189 |
<h1>🎤 Long-Form Text-to-Speech Generator</h1>
|
| 190 |
+
<p style="color: #666; font-size: 1.1em;">Choose a voice and transform any written text into expressive human-like speech</p>
|
| 191 |
</div>
|
| 192 |
""")
|
| 193 |
if tts_system:
|
|
|
|
| 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=tts_system.speakers[0] if tts_system else None,
|
| 220 |
label="🗣️ Choose Voice"
|
| 221 |
)
|
| 222 |
generate_btn = gr.Button("🎯 Generate Speech", variant="primary", size="lg", scale=1)
|