XuDongZhou commited on
Commit
e143019
·
verified ·
1 Parent(s): a72163b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -248,8 +248,8 @@ def generate_image(
248
  # prompt, negative_prompt = apply_style(style_name, prompt, negative_prompt)
249
 
250
  face_image = load_image(face_image_path)
251
- # face_image = resize_img(face_image, max_side=1024)
252
- face_image = resize_img(face_image)
253
  face_image_cv2 = convert_from_image_to_cv2(face_image)
254
  height, width, _ = face_image_cv2.shape
255
 
@@ -271,17 +271,15 @@ def generate_image(
271
  img_controlnet = face_image
272
  if pose_image_path is not None:
273
  pose_image = load_image(pose_image_path)
274
- # pose_image = resize_img(pose_image, max_side=1024)
275
- pose_image = resize_img(pose_image)
276
  img_controlnet = pose_image
277
  pose_image_cv2 = convert_from_image_to_cv2(pose_image)
278
 
279
  face_info = app.get(pose_image_cv2)
280
 
281
  if len(face_info) == 0:
282
- raise gr.Error(
283
- f"Cannot find any face in the reference image! Please upload another person image"
284
- )
285
 
286
  face_info = face_info[-1]
287
  face_kps = draw_kps(pose_image, face_info["kps"])
 
248
  # prompt, negative_prompt = apply_style(style_name, prompt, negative_prompt)
249
 
250
  face_image = load_image(face_image_path)
251
+ face_image = resize_img(face_image, max_side=1280)
252
+ # face_image = resize_img(face_image)
253
  face_image_cv2 = convert_from_image_to_cv2(face_image)
254
  height, width, _ = face_image_cv2.shape
255
 
 
271
  img_controlnet = face_image
272
  if pose_image_path is not None:
273
  pose_image = load_image(pose_image_path)
274
+ pose_image = resize_img(pose_image, max_side=1280)
275
+ # pose_image = resize_img(pose_image)
276
  img_controlnet = pose_image
277
  pose_image_cv2 = convert_from_image_to_cv2(pose_image)
278
 
279
  face_info = app.get(pose_image_cv2)
280
 
281
  if len(face_info) == 0:
282
+ raise gr.Error(f"Cannot find any face in the reference image! Please upload another person image")
 
 
283
 
284
  face_info = face_info[-1]
285
  face_kps = draw_kps(pose_image, face_info["kps"])