Spaces:
Runtime error
Runtime error
pengdaqian
commited on
Commit
·
b41bb60
1
Parent(s):
b9f0bca
fix
Browse files
app.py
CHANGED
|
@@ -182,6 +182,12 @@ def svc_main(sid, input_audio):
|
|
| 182 |
if input_audio is None:
|
| 183 |
return "You need to upload an audio", None
|
| 184 |
sampling_rate, audio = input_audio
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
uuid_value = uuid.uuid4()
|
| 186 |
uuid_string = str(uuid_value)
|
| 187 |
input_audio_tmp_file = f'{uuid_string}.wav'
|
|
@@ -244,8 +250,8 @@ def auto_search(name):
|
|
| 244 |
args=(name, config, save_path)
|
| 245 |
)
|
| 246 |
task2.start()
|
| 247 |
-
task1.join()
|
| 248 |
-
task2.join()
|
| 249 |
|
| 250 |
if not os.path.exists(save_path):
|
| 251 |
return "Not Found", None
|
|
|
|
| 182 |
if input_audio is None:
|
| 183 |
return "You need to upload an audio", None
|
| 184 |
sampling_rate, audio = input_audio
|
| 185 |
+
|
| 186 |
+
integer_dtypes = [np.int8, np.int16, np.int32, np.int64]
|
| 187 |
+
|
| 188 |
+
if audio.dtype in integer_dtypes:
|
| 189 |
+
audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
|
| 190 |
+
|
| 191 |
uuid_value = uuid.uuid4()
|
| 192 |
uuid_string = str(uuid_value)
|
| 193 |
input_audio_tmp_file = f'{uuid_string}.wav'
|
|
|
|
| 250 |
args=(name, config, save_path)
|
| 251 |
)
|
| 252 |
task2.start()
|
| 253 |
+
task1.join(timeout=20)
|
| 254 |
+
task2.join(timeout=10)
|
| 255 |
|
| 256 |
if not os.path.exists(save_path):
|
| 257 |
return "Not Found", None
|