Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -61,6 +61,12 @@ os.environ["PROCESSED_RESULTS"] = f"{os.getcwd()}/proprocess_results"
|
|
| 61 |
@spaces.GPU()
|
| 62 |
def tts_from_text(text, tts_dir, voice_choice):
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
text_to_speech = load_text_to_speech(True)
|
| 65 |
output = generate_speech(text_to_speech , [text], tts_dir, voice_choice)[0]
|
| 66 |
return output
|
|
|
|
| 61 |
@spaces.GPU()
|
| 62 |
def tts_from_text(text, tts_dir, voice_choice):
|
| 63 |
|
| 64 |
+
# --- HARD LIMIT: max 500 words ---
|
| 65 |
+
words = text.split()
|
| 66 |
+
if len(words) > 500:
|
| 67 |
+
words = words[:500]
|
| 68 |
+
text = " ".join(words)
|
| 69 |
+
|
| 70 |
text_to_speech = load_text_to_speech(True)
|
| 71 |
output = generate_speech(text_to_speech , [text], tts_dir, voice_choice)[0]
|
| 72 |
return output
|