Spaces:
Configuration error
Configuration error
Kangarroar
commited on
Commit
•
7caca23
1
Parent(s):
c278f67
Update app.py
Browse files
app.py
CHANGED
@@ -9,18 +9,29 @@ import torchcrepe
|
|
9 |
from infer import *
|
10 |
import logging
|
11 |
from infer_tools.infer_tool import *
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
inputs = gr.inputs.Textbox(lines=1, label="Enter a link:")
|
17 |
-
inputs += gr.inputs.Audio(label="Upload a WAV file:")
|
18 |
|
19 |
-
#
|
20 |
-
|
|
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
from infer import *
|
10 |
import logging
|
11 |
from infer_tools.infer_tool import *
|
12 |
+
##EDIT FOR CPU
|
13 |
+
# Open the file and read it into a string
|
14 |
+
with open("/home/user/.local/lib/python3.8/site-packages/torch/serialization.py") as f:
|
15 |
+
text = f.read()
|
|
|
|
|
16 |
|
17 |
+
# Replace the original line with the new line
|
18 |
+
text = text.replace("def load(f, map_location=None, pickle_module=pickle, **pickle_load_args):", "def load(f, map_location='cpu', pickle_module=pickle, **pickle_load_args):")
|
19 |
+
# Save the modified string to the original file
|
20 |
+
with open("/home/user/.local/lib/python3.8/site-packages/torch/serialization.py", "w") as f:
|
21 |
+
f.write(text)
|
22 |
|
23 |
+
print("Replaced")
|
24 |
+
with open("/home/user/.local/lib/python3.8/site-packages/torch/serialization.py") as f:
|
25 |
+
text = f.read()
|
26 |
+
print(text)
|
27 |
|
28 |
+
############
|
29 |
+
logging.getLogger('numba').setLevel(logging.WARNING)
|
30 |
+
|
31 |
+
# 工程文件夹名,训练时用的那个
|
32 |
+
project_name = "Unnamed"
|
33 |
+
model_path = f'./checkpoints/Unnamed/model_ckpt_steps_192000.ckpt'
|
34 |
+
config_path=f'./checkpoints/Unnamed/config.yaml'
|
35 |
+
hubert_gpu=False
|
36 |
+
svc_model = Svc(project_name,config_path,hubert_gpu, model_path)
|
37 |
+
print('model loaded')
|