Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -143,11 +143,7 @@ class NeuTTSWrapper:
|
|
| 143 |
|
| 144 |
def generate_speech_blocking(self, text: str, ref_audio_path: str) -> np.ndarray:
|
| 145 |
"""Blocking synthesis for standard endpoint."""
|
| 146 |
-
|
| 147 |
-
reference_audio, sr = sf.read(ref_audio_path)
|
| 148 |
-
if sr != SAMPLE_RATE:
|
| 149 |
-
# Simple check/resize logic required if sample rate mismatch occurs
|
| 150 |
-
pass
|
| 151 |
|
| 152 |
# 2. Encode reference
|
| 153 |
ref_s = self.tts_model.encode_reference(reference_audio)
|
|
@@ -161,11 +157,9 @@ class NeuTTSWrapper:
|
|
| 161 |
"""Sentence-by-Sentence Streaming (Blocking)."""
|
| 162 |
logger.info(f"Starting streaming synthesis for text length: {len(text)}")
|
| 163 |
|
| 164 |
-
# 1. Load reference audio (ONLY ONCE)
|
| 165 |
-
reference_audio, sr = sf.read(ref_audio_path)
|
| 166 |
|
| 167 |
-
|
| 168 |
-
ref_s = self.tts_model.encode_reference(
|
| 169 |
|
| 170 |
# 3. Split text
|
| 171 |
sentences = self._split_text_into_chunks(text)
|
|
|
|
| 143 |
|
| 144 |
def generate_speech_blocking(self, text: str, ref_audio_path: str) -> np.ndarray:
|
| 145 |
"""Blocking synthesis for standard endpoint."""
|
| 146 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
# 2. Encode reference
|
| 149 |
ref_s = self.tts_model.encode_reference(reference_audio)
|
|
|
|
| 157 |
"""Sentence-by-Sentence Streaming (Blocking)."""
|
| 158 |
logger.info(f"Starting streaming synthesis for text length: {len(text)}")
|
| 159 |
|
|
|
|
|
|
|
| 160 |
|
| 161 |
+
|
| 162 |
+
ref_s = self.tts_model.encode_reference(ref_audio_path)
|
| 163 |
|
| 164 |
# 3. Split text
|
| 165 |
sentences = self._split_text_into_chunks(text)
|