Upload app.py
Browse files
app.py
CHANGED
@@ -54,8 +54,8 @@ tokenizer = CLIPTokenizer.from_pretrained("SG161222/Realistic_Vision_V4.0_noVAE"
|
|
54 |
text_encoder = CLIPTextModel.from_pretrained("SG161222/Realistic_Vision_V4.0_noVAE", subfolder="text_encoder").to(dtype=torch.float16, device=args.device)
|
55 |
image_encoder = CLIPVisionModelWithProjection.from_pretrained("h94/IP-Adapter", subfolder="models/image_encoder").to(dtype=torch.float16, device=args.device)
|
56 |
unet = UNet2DConditionModel.from_pretrained("SG161222/Realistic_Vision_V4.0_noVAE", subfolder="unet").to(dtype=torch.float16,device=args.device)
|
57 |
-
image_face_fusion = pipeline('face_fusion_torch', model='damo/cv_unet_face_fusion_torch',
|
58 |
-
|
59 |
#face_model
|
60 |
app = FaceAnalysis(model_path="buffalo_l", providers=[('CUDAExecutionProvider', {"device_id": args.device})]) ##使用GPU:0, 默认使用buffalo_l就可以了
|
61 |
app.prepare(ctx_id=0, det_size=(640, 640))
|
@@ -163,7 +163,8 @@ def resize_img(input_image, max_side=640, min_side=512, size=None,
|
|
163 |
@spaces.GPU
|
164 |
def dress_process(garm_img, face_img, pose_img, prompt, cloth_guidance_scale, caption_guidance_scale,
|
165 |
face_guidance_scale,self_guidance_scale, cross_guidance_scale,if_ipa, if_post, if_control, denoise_steps, seed=42):
|
166 |
-
|
|
|
167 |
if prompt is None:
|
168 |
prompt = "a photography of a model"
|
169 |
prompt = prompt + ', best quality, high quality'
|
|
|
54 |
text_encoder = CLIPTextModel.from_pretrained("SG161222/Realistic_Vision_V4.0_noVAE", subfolder="text_encoder").to(dtype=torch.float16, device=args.device)
|
55 |
image_encoder = CLIPVisionModelWithProjection.from_pretrained("h94/IP-Adapter", subfolder="models/image_encoder").to(dtype=torch.float16, device=args.device)
|
56 |
unet = UNet2DConditionModel.from_pretrained("SG161222/Realistic_Vision_V4.0_noVAE", subfolder="unet").to(dtype=torch.float16,device=args.device)
|
57 |
+
# image_face_fusion = pipeline('face_fusion_torch', model='damo/cv_unet_face_fusion_torch',
|
58 |
+
# model_revision='v1.0.3', device='cpu')
|
59 |
#face_model
|
60 |
app = FaceAnalysis(model_path="buffalo_l", providers=[('CUDAExecutionProvider', {"device_id": args.device})]) ##使用GPU:0, 默认使用buffalo_l就可以了
|
61 |
app.prepare(ctx_id=0, det_size=(640, 640))
|
|
|
163 |
@spaces.GPU
|
164 |
def dress_process(garm_img, face_img, pose_img, prompt, cloth_guidance_scale, caption_guidance_scale,
|
165 |
face_guidance_scale,self_guidance_scale, cross_guidance_scale,if_ipa, if_post, if_control, denoise_steps, seed=42):
|
166 |
+
image_face_fusion = pipeline('face_fusion_torch', model='damo/cv_unet_face_fusion_torch',
|
167 |
+
model_revision='v1.0.3', device='cpu')
|
168 |
if prompt is None:
|
169 |
prompt = "a photography of a model"
|
170 |
prompt = prompt + ', best quality, high quality'
|