chenlei
commited on
Commit
·
07b7fc4
1
Parent(s):
279b7dc
update
Browse files
ootd/inference_ootd_dc.py
CHANGED
|
@@ -56,12 +56,13 @@ class OOTDiffusionDC:
|
|
| 56 |
|
| 57 |
#判断文件是否存在
|
| 58 |
filePath = "/home/user/app/checkpoints/ootd/text_encoder/pytorch_model.bin"
|
| 59 |
-
if os.path.exists(filePath)
|
| 60 |
url = "https://huggingface.co/yangjoe/pytorch_model/resolve/main/pytorch_model.bin"
|
| 61 |
response = requests.get(url)
|
| 62 |
#下载该文件
|
| 63 |
with open("/home/user/app/checkpoints/ootd/text_encoder/pytorch_model.bin", "wb") as f:
|
| 64 |
f.write(response.content)
|
|
|
|
| 65 |
|
| 66 |
self.pipe = OotdPipeline.from_pretrained(
|
| 67 |
MODEL_PATH,
|
|
|
|
| 56 |
|
| 57 |
#判断文件是否存在
|
| 58 |
filePath = "/home/user/app/checkpoints/ootd/text_encoder/pytorch_model.bin"
|
| 59 |
+
if not os.path.exists(filePath) :
|
| 60 |
url = "https://huggingface.co/yangjoe/pytorch_model/resolve/main/pytorch_model.bin"
|
| 61 |
response = requests.get(url)
|
| 62 |
#下载该文件
|
| 63 |
with open("/home/user/app/checkpoints/ootd/text_encoder/pytorch_model.bin", "wb") as f:
|
| 64 |
f.write(response.content)
|
| 65 |
+
print("pytorch_model.bin下载完成")
|
| 66 |
|
| 67 |
self.pipe = OotdPipeline.from_pretrained(
|
| 68 |
MODEL_PATH,
|
ootd/inference_ootd_hd.py
CHANGED
|
@@ -56,12 +56,13 @@ class OOTDiffusionHD:
|
|
| 56 |
)
|
| 57 |
#判断文件是否存在
|
| 58 |
filePath = "/home/user/app/checkpoints/ootd/text_encoder/pytorch_model.bin"
|
| 59 |
-
if os.path.exists(filePath)
|
| 60 |
url = "https://huggingface.co/yangjoe/pytorch_model/resolve/main/pytorch_model.bin"
|
| 61 |
response = requests.get(url)
|
| 62 |
#下载该文件
|
| 63 |
with open("/home/user/app/checkpoints/ootd/text_encoder/pytorch_model.bin", "wb") as f:
|
| 64 |
f.write(response.content)
|
|
|
|
| 65 |
|
| 66 |
self.pipe = OotdPipeline.from_pretrained(
|
| 67 |
MODEL_PATH,
|
|
|
|
| 56 |
)
|
| 57 |
#判断文件是否存在
|
| 58 |
filePath = "/home/user/app/checkpoints/ootd/text_encoder/pytorch_model.bin"
|
| 59 |
+
if not os.path.exists(filePath) :
|
| 60 |
url = "https://huggingface.co/yangjoe/pytorch_model/resolve/main/pytorch_model.bin"
|
| 61 |
response = requests.get(url)
|
| 62 |
#下载该文件
|
| 63 |
with open("/home/user/app/checkpoints/ootd/text_encoder/pytorch_model.bin", "wb") as f:
|
| 64 |
f.write(response.content)
|
| 65 |
+
print("pytorch_model.bin下载完成")
|
| 66 |
|
| 67 |
self.pipe = OotdPipeline.from_pretrained(
|
| 68 |
MODEL_PATH,
|
preprocess/openpose/annotator/openpose/__init__.py
CHANGED
|
@@ -16,6 +16,7 @@ from .body import Body
|
|
| 16 |
from .hand import Hand
|
| 17 |
from .face import Face
|
| 18 |
from annotator.util import annotator_ckpts_path
|
|
|
|
| 19 |
|
| 20 |
body_model_path = "https://huggingface.co/lllyasviel/Annotators/resolve/main/body_pose_model.pth"
|
| 21 |
hand_model_path = "https://huggingface.co/lllyasviel/Annotators/resolve/main/hand_pose_model.pth"
|
|
@@ -49,8 +50,13 @@ class OpenposeDetector:
|
|
| 49 |
# face_modelpath = os.path.join(annotator_ckpts_path, "facenet.pth")
|
| 50 |
|
| 51 |
if not os.path.exists(body_modelpath):
|
| 52 |
-
from basicsr.utils.download_util import load_file_from_url
|
| 53 |
-
load_file_from_url(body_model_path, model_dir=annotator_ckpts_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
# if not os.path.exists(hand_modelpath):
|
| 56 |
# from basicsr.utils.download_util import load_file_from_url
|
|
|
|
| 16 |
from .hand import Hand
|
| 17 |
from .face import Face
|
| 18 |
from annotator.util import annotator_ckpts_path
|
| 19 |
+
import requests
|
| 20 |
|
| 21 |
body_model_path = "https://huggingface.co/lllyasviel/Annotators/resolve/main/body_pose_model.pth"
|
| 22 |
hand_model_path = "https://huggingface.co/lllyasviel/Annotators/resolve/main/hand_pose_model.pth"
|
|
|
|
| 50 |
# face_modelpath = os.path.join(annotator_ckpts_path, "facenet.pth")
|
| 51 |
|
| 52 |
if not os.path.exists(body_modelpath):
|
| 53 |
+
# from basicsr.utils.download_util import load_file_from_url
|
| 54 |
+
# load_file_from_url(body_model_path, model_dir=annotator_ckpts_path)
|
| 55 |
+
response = requests.get(body_model_path)
|
| 56 |
+
#下载该文件
|
| 57 |
+
with open("/home/user/app/checkpoints/openpose/ckpts/body_pose_model.pth", "wb") as f:
|
| 58 |
+
f.write(response.content)
|
| 59 |
+
print("body_pose_model.pth下载完成")
|
| 60 |
|
| 61 |
# if not os.path.exists(hand_modelpath):
|
| 62 |
# from basicsr.utils.download_util import load_file_from_url
|