Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -60,7 +60,7 @@ target_sample_rate = 24000
|
|
| 60 |
n_mel_channels = 100
|
| 61 |
hop_length = 256
|
| 62 |
target_rms = 0.1
|
| 63 |
-
nfe_step =
|
| 64 |
cfg_strength = 2.0
|
| 65 |
ode_method = "euler"
|
| 66 |
sway_sampling_coef = -1.0
|
|
@@ -200,10 +200,10 @@ def infer_batch(ref_audio, ref_text, gen_text_batches, exp_name, remove_silence,
|
|
| 200 |
ref_text_len = len(ref_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, ref_text))
|
| 201 |
gen_text_len = len(gen_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, gen_text))
|
| 202 |
if len(ref_text.encode('utf-8')) > 2:
|
| 203 |
-
duration = min(2000, max(
|
| 204 |
print(f"Duration: {duration} seconds")
|
| 205 |
else:
|
| 206 |
-
duration = min(2000, max(
|
| 207 |
print(f"Duration: {duration} seconds")
|
| 208 |
|
| 209 |
# inference
|
|
|
|
| 60 |
n_mel_channels = 100
|
| 61 |
hop_length = 256
|
| 62 |
target_rms = 0.1
|
| 63 |
+
nfe_step = 10 # 16, 32
|
| 64 |
cfg_strength = 2.0
|
| 65 |
ode_method = "euler"
|
| 66 |
sway_sampling_coef = -1.0
|
|
|
|
| 200 |
ref_text_len = len(ref_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, ref_text))
|
| 201 |
gen_text_len = len(gen_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, gen_text))
|
| 202 |
if len(ref_text.encode('utf-8')) > 2:
|
| 203 |
+
duration = min(2000, max(270, (ref_audio_len + int(ref_audio_len / ref_text_len * gen_text_len / speed))))
|
| 204 |
print(f"Duration: {duration} seconds")
|
| 205 |
else:
|
| 206 |
+
duration = min(2000, max(270, int(150 * gen_text_len / (speed * 10))))
|
| 207 |
print(f"Duration: {duration} seconds")
|
| 208 |
|
| 209 |
# inference
|