Spaces:
Build error
Build error
Update inference.py
Browse files- inference.py +7 -3
inference.py
CHANGED
@@ -52,11 +52,15 @@ def get_text(wav,sr,transform=1.0):
|
|
52 |
def getkey(key):
|
53 |
return np.power(2,key/12.0)
|
54 |
|
55 |
-
def infer(f,speaker,key,reqf0=False):
|
56 |
speaker=int(speaker[7:])
|
57 |
-
if f is None:
|
|
|
|
|
|
|
|
|
58 |
return "请上传音频", None
|
59 |
-
sr, audio =
|
60 |
if sr<16000:
|
61 |
return "采样率过低,请上传至少拥有16000Hz采样率的音频",None
|
62 |
duration = audio.shape[0] / sr
|
|
|
52 |
def getkey(key):
|
53 |
return np.power(2,key/12.0)
|
54 |
|
55 |
+
def infer(f,r,speaker,key,reqf0=False):
|
56 |
speaker=int(speaker[7:])
|
57 |
+
if not f is None:
|
58 |
+
file=f
|
59 |
+
else if not r is None:
|
60 |
+
file=r
|
61 |
+
else:
|
62 |
return "请上传音频", None
|
63 |
+
sr, audio = file
|
64 |
if sr<16000:
|
65 |
return "采样率过低,请上传至少拥有16000Hz采样率的音频",None
|
66 |
duration = audio.shape[0] / sr
|