tying to solve RuntimeError: CUDA must not be initialized in the main process on Spaces with Stateless GPU environment.
Browse files
app.py
CHANGED
@@ -75,6 +75,8 @@ def download_smplx():
|
|
75 |
def infer(fn, det_thresh, nms_kernel_size):
|
76 |
global device
|
77 |
global model
|
|
|
|
|
78 |
|
79 |
# Is it an image from example_data_dir ?
|
80 |
basename = Path(os.path.basename(fn)).stem
|
@@ -215,7 +217,8 @@ if __name__ == "__main__":
|
|
215 |
download_smplx()
|
216 |
|
217 |
# Loading the model
|
218 |
-
model = _load_model(args.model_name, device=device)
|
|
|
219 |
|
220 |
# Gradio demo
|
221 |
with gr.Blocks(title="Multi-HMR", css=".gradio-container") as demo:
|
|
|
75 |
def infer(fn, det_thresh, nms_kernel_size):
|
76 |
global device
|
77 |
global model
|
78 |
+
|
79 |
+
model = model.to(device)
|
80 |
|
81 |
# Is it an image from example_data_dir ?
|
82 |
basename = Path(os.path.basename(fn)).stem
|
|
|
217 |
download_smplx()
|
218 |
|
219 |
# Loading the model
|
220 |
+
# model = _load_model(args.model_name, device=device)
|
221 |
+
model = _load_model(args.model_name, device=torch.device('cpu'))
|
222 |
|
223 |
# Gradio demo
|
224 |
with gr.Blocks(title="Multi-HMR", css=".gradio-container") as demo:
|