Spaces:
Build error
Build error
Update inference.py
Browse files- inference.py +2 -2
inference.py
CHANGED
|
@@ -40,7 +40,7 @@ def get_text(file,transform=1.0):
|
|
| 40 |
wav16=wav
|
| 41 |
|
| 42 |
source = {"source":np.expand_dims(np.expand_dims(wav16,0),0)}
|
| 43 |
-
hubertsession = onnxruntime.InferenceSession("
|
| 44 |
units = np.array(hubertsession.run(['embed'], source)[0])
|
| 45 |
f0=_calculate_f0(wav,units.shape[1],sr,
|
| 46 |
f0min=librosa.note_to_hz('C2'),
|
|
@@ -59,7 +59,7 @@ def infer(f,o,speaker,key,reqf0=False):
|
|
| 59 |
x_lengths = [np.size(x,1)]
|
| 60 |
sid = [speaker]
|
| 61 |
ort_inputs = {'x':x,'x_lengths':x_lengths,'sid':sid,"noise_scale":[0.667],"length_scale":[1.0],"noise_scale_w":[0.8]}
|
| 62 |
-
infersession = onnxruntime.InferenceSession("
|
| 63 |
ort_output = infersession.run(['audio'], ort_inputs)
|
| 64 |
sf.write(o,ort_output[0][0][0],22050,'PCM_16',format='wav')
|
| 65 |
o.seek(0,0)
|
|
|
|
| 40 |
wav16=wav
|
| 41 |
|
| 42 |
source = {"source":np.expand_dims(np.expand_dims(wav16,0),0)}
|
| 43 |
+
hubertsession = onnxruntime.InferenceSession("hubert.onnx")#,providers=['CUDAExecutionProvider'])
|
| 44 |
units = np.array(hubertsession.run(['embed'], source)[0])
|
| 45 |
f0=_calculate_f0(wav,units.shape[1],sr,
|
| 46 |
f0min=librosa.note_to_hz('C2'),
|
|
|
|
| 59 |
x_lengths = [np.size(x,1)]
|
| 60 |
sid = [speaker]
|
| 61 |
ort_inputs = {'x':x,'x_lengths':x_lengths,'sid':sid,"noise_scale":[0.667],"length_scale":[1.0],"noise_scale_w":[0.8]}
|
| 62 |
+
infersession = onnxruntime.InferenceSession("onnxmodel334.onnx")#,providers=['CUDAExecutionProvider'])
|
| 63 |
ort_output = infersession.run(['audio'], ort_inputs)
|
| 64 |
sf.write(o,ort_output[0][0][0],22050,'PCM_16',format='wav')
|
| 65 |
o.seek(0,0)
|