alexnasa commited on
Commit
b614e6c
·
verified ·
1 Parent(s): df0d676

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
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