Spaces:
Build error
Build error
Update inference.py
Browse files- inference.py +2 -1
inference.py
CHANGED
@@ -55,6 +55,7 @@ def getkey(key):
|
|
55 |
return np.power(2,key/12.0)
|
56 |
|
57 |
def infer(f,speaker,key,reqf0=False):
|
|
|
58 |
if f is None:
|
59 |
return "You need to upload an audio", None
|
60 |
sr, audio = f
|
@@ -64,7 +65,7 @@ def infer(f,speaker,key,reqf0=False):
|
|
64 |
audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
|
65 |
x,sourcef0 = get_text(audio,sr,getkey(key))
|
66 |
x_lengths = [np.size(x,1)]
|
67 |
-
sid = [
|
68 |
ort_inputs = {'x':x,'x_lengths':x_lengths,'sid':sid,"noise_scale":[0.667],"length_scale":[1.0],"noise_scale_w":[0.8]}
|
69 |
infersession = onnxruntime.InferenceSession("onnxmodel334.onnx")#,providers=['CUDAExecutionProvider'])
|
70 |
ort_output = infersession.run(['audio'], ort_inputs)
|
|
|
55 |
return np.power(2,key/12.0)
|
56 |
|
57 |
def infer(f,speaker,key,reqf0=False):
|
58 |
+
speaker=int(speaker[7:])
|
59 |
if f is None:
|
60 |
return "You need to upload an audio", None
|
61 |
sr, audio = f
|
|
|
65 |
audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
|
66 |
x,sourcef0 = get_text(audio,sr,getkey(key))
|
67 |
x_lengths = [np.size(x,1)]
|
68 |
+
sid = [speaker]
|
69 |
ort_inputs = {'x':x,'x_lengths':x_lengths,'sid':sid,"noise_scale":[0.667],"length_scale":[1.0],"noise_scale_w":[0.8]}
|
70 |
infersession = onnxruntime.InferenceSession("onnxmodel334.onnx")#,providers=['CUDAExecutionProvider'])
|
71 |
ort_output = infersession.run(['audio'], ort_inputs)
|