Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -208,7 +208,7 @@ def infer_batch(ref_audio, ref_text, gen_text_batches, exp_name, remove_silence,
|
|
208 |
# Calculate duration
|
209 |
ref_text_len = len(ref_text.encode("utf-8"))
|
210 |
gen_text_len = len(gen_text.encode("utf-8"))
|
211 |
-
duration = ref_audio_len + int(ref_audio_len / ref_text_len * gen_text_len / speed)
|
212 |
# Print the calculated duration
|
213 |
print(f"Duration: {duration} seconds")
|
214 |
# inference
|
@@ -361,7 +361,7 @@ def infer(ref_audio_orig, ref_text, gen_text, exp_name, remove_silence, cross_fa
|
|
361 |
audio, sr = torchaudio.load(ref_audio)
|
362 |
|
363 |
# Use the new chunk_text function to split gen_text
|
364 |
-
max_chars = int(0.8(len(ref_text.encode('utf-8')) / (audio.shape[-1] / sr) * (25 - audio.shape[-1] / sr)))
|
365 |
gen_text_batches = chunk_text(gen_text, max_chars=max_chars)
|
366 |
print('ref_text', ref_text)
|
367 |
for i, batch_text in enumerate(gen_text_batches):
|
|
|
208 |
# Calculate duration
|
209 |
ref_text_len = len(ref_text.encode("utf-8"))
|
210 |
gen_text_len = len(gen_text.encode("utf-8"))
|
211 |
+
duration = ref_audio_len + int(ref_audio_len / ref_text_len * gen_text_len / speed * 0.8)
|
212 |
# Print the calculated duration
|
213 |
print(f"Duration: {duration} seconds")
|
214 |
# inference
|
|
|
361 |
audio, sr = torchaudio.load(ref_audio)
|
362 |
|
363 |
# Use the new chunk_text function to split gen_text
|
364 |
+
max_chars = int(0.8 * (len(ref_text.encode('utf-8')) / (audio.shape[-1] / sr) * (25 - audio.shape[-1] / sr)))
|
365 |
gen_text_batches = chunk_text(gen_text, max_chars=max_chars)
|
366 |
print('ref_text', ref_text)
|
367 |
for i, batch_text in enumerate(gen_text_batches):
|