ameythakur commited on
Commit
84707de
·
verified ·
1 Parent(s): bbb8ab0

text2video

Browse files
Source Code/annotator/openpose/__init__.py CHANGED
@@ -18,8 +18,18 @@ class OpenposeDetector:
18
  body_modelpath = os.path.join(annotator_ckpts_path, "body_pose_model.pth")
19
  hand_modelpath = os.path.join(annotator_ckpts_path, "hand_pose_model.pth")
20
 
21
- if not os.path.exists(hand_modelpath) or not os.path.exists(body_modelpath):
22
- raise FileNotFoundError(f"Openpose models not found in {annotator_ckpts_path}. Please ensure body_pose_model.pth and hand_pose_model.pth are present.")
 
 
 
 
 
 
 
 
 
 
23
 
24
  self.body_estimation = Body(body_modelpath)
25
  self.hand_estimation = Hand(hand_modelpath)
 
18
  body_modelpath = os.path.join(annotator_ckpts_path, "body_pose_model.pth")
19
  hand_modelpath = os.path.join(annotator_ckpts_path, "hand_pose_model.pth")
20
 
21
+ if not os.path.exists(annotator_ckpts_path):
22
+ os.makedirs(annotator_ckpts_path)
23
+
24
+ if not os.path.exists(body_modelpath):
25
+ from torch.hub import download_url_to_file
26
+ print(f"Downloading body_pose_model from {body_model_path}...")
27
+ download_url_to_file(body_model_path, body_modelpath)
28
+
29
+ if not os.path.exists(hand_modelpath):
30
+ from torch.hub import download_url_to_file
31
+ print(f"Downloading hand_pose_model from {hand_model_path}...")
32
+ download_url_to_file(hand_model_path, hand_modelpath)
33
 
34
  self.body_estimation = Body(body_modelpath)
35
  self.hand_estimation = Hand(hand_modelpath)