Spaces:
Running
Running
MarcusSu1216
commited on
Commit
•
642023f
1
Parent(s):
50caebe
Update flask_api.py
Browse files- flask_api.py +3 -7
flask_api.py
CHANGED
@@ -30,13 +30,10 @@ def voice_change_model():
|
|
30 |
|
31 |
# 模型推理
|
32 |
if raw_infer:
|
33 |
-
|
34 |
-
out_audio, out_sr = svc_model.infer(speaker_id, f_pitch_change, input_wav_path, cluster_infer_ratio=0,
|
35 |
-
auto_predict_f0=False, noice_scale=0.4, f0_filter=False)
|
36 |
tar_audio = torchaudio.functional.resample(out_audio, svc_model.target_sample, daw_sample)
|
37 |
else:
|
38 |
-
out_audio = svc.process(svc_model, speaker_id, f_pitch_change, input_wav_path
|
39 |
-
auto_predict_f0=False, noice_scale=0.4, f0_filter=False)
|
40 |
tar_audio = torchaudio.functional.resample(torch.from_numpy(out_audio), svc_model.target_sample, daw_sample)
|
41 |
# 返回音频
|
42 |
out_wav_path = io.BytesIO()
|
@@ -53,8 +50,7 @@ if __name__ == '__main__':
|
|
53 |
# 每个模型和config是唯一对应的
|
54 |
model_name = "logs/32k/G_174000-Copy1.pth"
|
55 |
config_name = "configs/config.json"
|
56 |
-
|
57 |
-
svc_model = Svc(model_name, config_name, cluster_model_path=cluster_model_path)
|
58 |
svc = RealTimeVC()
|
59 |
# 此处与vst插件对应,不建议更改
|
60 |
app.run(port=6842, host="0.0.0.0", debug=False, threaded=False)
|
|
|
30 |
|
31 |
# 模型推理
|
32 |
if raw_infer:
|
33 |
+
out_audio, out_sr = svc_model.infer(speaker_id, f_pitch_change, input_wav_path)
|
|
|
|
|
34 |
tar_audio = torchaudio.functional.resample(out_audio, svc_model.target_sample, daw_sample)
|
35 |
else:
|
36 |
+
out_audio = svc.process(svc_model, speaker_id, f_pitch_change, input_wav_path)
|
|
|
37 |
tar_audio = torchaudio.functional.resample(torch.from_numpy(out_audio), svc_model.target_sample, daw_sample)
|
38 |
# 返回音频
|
39 |
out_wav_path = io.BytesIO()
|
|
|
50 |
# 每个模型和config是唯一对应的
|
51 |
model_name = "logs/32k/G_174000-Copy1.pth"
|
52 |
config_name = "configs/config.json"
|
53 |
+
svc_model = Svc(model_name, config_name)
|
|
|
54 |
svc = RealTimeVC()
|
55 |
# 此处与vst插件对应,不建议更改
|
56 |
app.run(port=6842, host="0.0.0.0", debug=False, threaded=False)
|