Kangarroar commited on
Commit
7caca23
1 Parent(s): c278f67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -12
app.py CHANGED
@@ -9,18 +9,29 @@ import torchcrepe
9
  from infer import *
10
  import logging
11
  from infer_tools.infer_tool import *
12
- import gradio as gr
13
- import transformers
14
- device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
15
- # define the input interface for the app
16
- inputs = gr.inputs.Textbox(lines=1, label="Enter a link:")
17
- inputs += gr.inputs.Audio(label="Upload a WAV file:")
18
 
19
- # define the output interface for the app
20
- outputs = gr.outputs.Textbox(lines=1, label="Diff-SVC prediction:")
 
 
 
21
 
22
- # define the app itself
23
- app = gr.Interface(model, inputs, outputs, title="DIFF-SVC Inference Cloud")
 
 
24
 
25
- # run the app
26
- app.launch()
 
 
 
 
 
 
 
 
 
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')