Spaces:
Sleeping
Sleeping
Support zeroGPU
Browse files
preprocess/humanparsing/run_parsing.py
CHANGED
|
@@ -47,8 +47,8 @@ def download_model_file(model_path, url):
|
|
| 47 |
class Parsing:
|
| 48 |
def __init__(self, gpu_id: int):
|
| 49 |
# zeroGPU
|
| 50 |
-
self.gpu_id = gpu_id
|
| 51 |
-
torch.cuda.set_device(gpu_id)
|
| 52 |
|
| 53 |
# Model paths
|
| 54 |
base_path = Path(__file__).absolute().parents[2].absolute()
|
|
@@ -76,6 +76,6 @@ class Parsing:
|
|
| 76 |
|
| 77 |
def __call__(self, input_image):
|
| 78 |
# zeroGPU
|
| 79 |
-
torch.cuda.set_device(self.gpu_id)
|
| 80 |
parsed_image, face_mask = onnx_inference(self.session, self.lip_session, input_image)
|
| 81 |
return parsed_image, face_mask
|
|
|
|
| 47 |
class Parsing:
|
| 48 |
def __init__(self, gpu_id: int):
|
| 49 |
# zeroGPU
|
| 50 |
+
# self.gpu_id = gpu_id
|
| 51 |
+
# torch.cuda.set_device(gpu_id)
|
| 52 |
|
| 53 |
# Model paths
|
| 54 |
base_path = Path(__file__).absolute().parents[2].absolute()
|
|
|
|
| 76 |
|
| 77 |
def __call__(self, input_image):
|
| 78 |
# zeroGPU
|
| 79 |
+
# torch.cuda.set_device(self.gpu_id)
|
| 80 |
parsed_image, face_mask = onnx_inference(self.session, self.lip_session, input_image)
|
| 81 |
return parsed_image, face_mask
|
preprocess/openpose/run_openpose.py
CHANGED
|
@@ -28,13 +28,13 @@ import pdb
|
|
| 28 |
class OpenPose:
|
| 29 |
def __init__(self, gpu_id: int):
|
| 30 |
# zeroGPU
|
| 31 |
-
self.gpu_id = gpu_id
|
| 32 |
-
torch.cuda.set_device(gpu_id)
|
| 33 |
self.preprocessor = OpenposeDetector()
|
| 34 |
|
| 35 |
def __call__(self, input_image, resolution=384):
|
| 36 |
# zeroGPU
|
| 37 |
-
torch.cuda.set_device(self.gpu_id)
|
| 38 |
if isinstance(input_image, Image.Image):
|
| 39 |
input_image = np.asarray(input_image)
|
| 40 |
elif type(input_image) == str:
|
|
|
|
| 28 |
class OpenPose:
|
| 29 |
def __init__(self, gpu_id: int):
|
| 30 |
# zeroGPU
|
| 31 |
+
# self.gpu_id = gpu_id
|
| 32 |
+
# torch.cuda.set_device(gpu_id)
|
| 33 |
self.preprocessor = OpenposeDetector()
|
| 34 |
|
| 35 |
def __call__(self, input_image, resolution=384):
|
| 36 |
# zeroGPU
|
| 37 |
+
# torch.cuda.set_device(self.gpu_id)
|
| 38 |
if isinstance(input_image, Image.Image):
|
| 39 |
input_image = np.asarray(input_image)
|
| 40 |
elif type(input_image) == str:
|