Spaces:
Runtime error
Runtime error
first commit
Browse files
annotator/hed/__init__.py
CHANGED
|
@@ -67,10 +67,10 @@ class HEDdetector:
|
|
| 67 |
def __init__(self):
|
| 68 |
remote_model_path = "https://huggingface.co/lllyasviel/Annotators/resolve/main/ControlNetHED.pth"
|
| 69 |
modelpath = remote_model_path
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
self.netNetwork = ControlNetHED_Apache2().float().cuda().eval()
|
| 75 |
self.netNetwork.load_state_dict(torch.load(modelpath))
|
| 76 |
|
|
|
|
| 67 |
def __init__(self):
|
| 68 |
remote_model_path = "https://huggingface.co/lllyasviel/Annotators/resolve/main/ControlNetHED.pth"
|
| 69 |
modelpath = remote_model_path
|
| 70 |
+
modelpath = os.path.join(annotator_ckpts_path, "ControlNetHED.pth")
|
| 71 |
+
if not os.path.exists(modelpath):
|
| 72 |
+
from basicsr.utils.download_util import load_file_from_url
|
| 73 |
+
load_file_from_url(remote_model_path, model_dir=annotator_ckpts_path)
|
| 74 |
self.netNetwork = ControlNetHED_Apache2().float().cuda().eval()
|
| 75 |
self.netNetwork.load_state_dict(torch.load(modelpath))
|
| 76 |
|
annotator/openpose/__init__.py
CHANGED
|
@@ -30,13 +30,13 @@ hand_model_path = "https://huggingface.co/lllyasviel/ControlNet/resolve/main/ann
|
|
| 30 |
|
| 31 |
class OpenposeDetector:
|
| 32 |
def __init__(self):
|
| 33 |
-
|
| 34 |
-
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
|
| 41 |
self.body_estimation = Body(body_modelpath)
|
| 42 |
self.hand_estimation = Hand(hand_modelpath)
|
|
|
|
| 30 |
|
| 31 |
class OpenposeDetector:
|
| 32 |
def __init__(self):
|
| 33 |
+
body_modelpath = os.path.join(annotator_ckpts_path, "body_pose_model.pth")
|
| 34 |
+
hand_modelpath = os.path.join(annotator_ckpts_path, "hand_pose_model.pth")
|
| 35 |
|
| 36 |
+
if not os.path.exists(hand_modelpath):
|
| 37 |
+
from basicsr.utils.download_util import load_file_from_url
|
| 38 |
+
load_file_from_url(body_model_path, model_dir=annotator_ckpts_path)
|
| 39 |
+
load_file_from_url(hand_model_path, model_dir=annotator_ckpts_path)
|
| 40 |
|
| 41 |
self.body_estimation = Body(body_modelpath)
|
| 42 |
self.hand_estimation = Hand(hand_modelpath)
|