Spaces:
Running
on
Zero
Running
on
Zero
Add animated version announcement for V1.0.0 in the demo interface
Browse files- app.py +1 -1
- tts_model_v1.py +8 -3
app.py
CHANGED
@@ -388,7 +388,7 @@ with gr.Blocks(title="Kokoro TTS Demo", css=styling) as demo:
|
|
388 |
gr.HTML("""
|
389 |
<div style="
|
390 |
text-align: center;
|
391 |
-
margin-bottom:
|
392 |
font-weight: bold;
|
393 |
color: #05d9e8;
|
394 |
text-shadow: 0 0 10px #05d9e8, 0 0 20px #05d9e8;
|
|
|
388 |
gr.HTML("""
|
389 |
<div style="
|
390 |
text-align: center;
|
391 |
+
margin-bottom: 2px;
|
392 |
font-weight: bold;
|
393 |
color: #05d9e8;
|
394 |
text-shadow: 0 0 10px #05d9e8, 0 0 20px #05d9e8;
|
tts_model_v1.py
CHANGED
@@ -68,13 +68,18 @@ class TTSModelV1:
|
|
68 |
chunk_sizes = []
|
69 |
total_tokens = 0
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
# Get generator from pipeline
|
72 |
generator = self.pipeline(
|
73 |
-
|
74 |
voice=voice_name,
|
75 |
speed=speed,
|
76 |
-
split_pattern=r'\n\n+'
|
77 |
-
preprocess_text=lambda t: t.replace('\n', ' ').replace(' ', ' ') # Replace single newlines with spaces
|
78 |
)
|
79 |
|
80 |
# Process chunks
|
|
|
68 |
chunk_sizes = []
|
69 |
total_tokens = 0
|
70 |
|
71 |
+
# Preprocess text - replace single newlines with spaces while preserving paragraphs
|
72 |
+
processed_text = '\n\n'.join(
|
73 |
+
paragraph.replace('\n', ' ').replace(' ', ' ').strip()
|
74 |
+
for paragraph in text.split('\n\n')
|
75 |
+
)
|
76 |
+
|
77 |
# Get generator from pipeline
|
78 |
generator = self.pipeline(
|
79 |
+
processed_text,
|
80 |
voice=voice_name,
|
81 |
speed=speed,
|
82 |
+
split_pattern=r'\n\n+' # Split on double newlines or more
|
|
|
83 |
)
|
84 |
|
85 |
# Process chunks
|