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