Spaces:
Configuration error
Configuration error
Commit
·
c278f67
1
Parent(s):
5e81135
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,30 +24,3 @@ app = gr.Interface(model, inputs, outputs, title="DIFF-SVC Inference Cloud")
|
|
| 24 |
|
| 25 |
# run the app
|
| 26 |
app.launch()
|
| 27 |
-
|
| 28 |
-
##EDIT FOR CPU
|
| 29 |
-
# Open the file and read it into a string
|
| 30 |
-
with open("/home/user/.local/lib/python3.8/site-packages/torch/serialization.py") as f:
|
| 31 |
-
text = f.read()
|
| 32 |
-
|
| 33 |
-
# Replace the original line with the new line
|
| 34 |
-
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):")
|
| 35 |
-
# Save the modified string to the original file
|
| 36 |
-
with open("/home/user/.local/lib/python3.8/site-packages/torch/serialization.py", "w") as f:
|
| 37 |
-
f.write(text)
|
| 38 |
-
|
| 39 |
-
print("Replaced")
|
| 40 |
-
with open("/home/user/.local/lib/python3.8/site-packages/torch/serialization.py") as f:
|
| 41 |
-
text = f.read()
|
| 42 |
-
print(text)
|
| 43 |
-
|
| 44 |
-
############
|
| 45 |
-
logging.getLogger('numba').setLevel(logging.WARNING)
|
| 46 |
-
|
| 47 |
-
# 工程文件夹名,训练时用的那个
|
| 48 |
-
project_name = "Unnamed"
|
| 49 |
-
model_path = f'./checkpoints/Unnamed/model_ckpt_steps_192000.ckpt'
|
| 50 |
-
config_path=f'./checkpoints/Unnamed/config.yaml'
|
| 51 |
-
hubert_gpu=False
|
| 52 |
-
svc_model = Svc(project_name,config_path,hubert_gpu, model_path)
|
| 53 |
-
print('model loaded')
|
|
|
|
| 24 |
|
| 25 |
# run the app
|
| 26 |
app.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|