Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,7 +44,7 @@ def update_model(model_name):
|
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
-
def text_to_speech(text, model_name="kokoro-v0_19-half.pth", voice_name="af", speed=1.0,
|
| 48 |
"""
|
| 49 |
Converts text to speech using the specified parameters and ensures the model is updated only if necessary.
|
| 50 |
"""
|
|
@@ -263,7 +263,7 @@ def your_tts(text,audio_path,actual_duration,speed=1.0):
|
|
| 263 |
tts_duration = len(tts_audio)
|
| 264 |
if tts_duration > actual_duration:
|
| 265 |
speedup_factor = tts_duration / actual_duration
|
| 266 |
-
tts_path=text_to_speech(text, model_name, voice_name=srt_voice_name,speed=speedup_factor)
|
| 267 |
print(tts_path)
|
| 268 |
shutil.copy(tts_path,audio_path)
|
| 269 |
|
|
|
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
+
def text_to_speech(text, model_name="kokoro-v0_19-half.pth", voice_name="af", speed=1.0, pad_between_segments=0, remove_silence=True, minimum_silence=0.20,trim=0.5):
|
| 48 |
"""
|
| 49 |
Converts text to speech using the specified parameters and ensures the model is updated only if necessary.
|
| 50 |
"""
|
|
|
|
| 263 |
tts_duration = len(tts_audio)
|
| 264 |
if tts_duration > actual_duration:
|
| 265 |
speedup_factor = tts_duration / actual_duration
|
| 266 |
+
tts_path=text_to_speech(text, model_name, voice_name=srt_voice_name,speed=speedup_factor,trim=1.0)
|
| 267 |
print(tts_path)
|
| 268 |
shutil.copy(tts_path,audio_path)
|
| 269 |
|