selfitcamera commited on
Commit
a14828a
·
1 Parent(s): 82a48f4
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -35,10 +35,6 @@ def onClick(cloth_id, pose_image, pose_id, size, request: gr.Request):
35
  if pose_image is None:
36
  return None, "no pose image found !", ""
37
 
38
- faces = face_detector.detect_faces(pose_image[:,:,::-1])
39
- if len(faces)==0:
40
- return None, "Failed !!! No face detected !!! please upload a human photo!!! Not clothing photo!!!", ""
41
-
42
  # pose_id, cloth_id = pose_id['label'], cloth_id['label']
43
  # print(pose_id, cloth_id, size, (pose_image is None), len(pose_id)>0)
44
  if len(pose_id)>0:
@@ -48,6 +44,12 @@ def onClick(cloth_id, pose_image, pose_id, size, request: gr.Request):
48
  # res = cv2.imread(res)
49
  return res, "Done! Use the pre-run results directly, the cloth size does not take effect ", mk_guide
50
  else:
 
 
 
 
 
 
51
  try:
52
  client_ip = request.client.host
53
  x_forwarded_for = dict(request.headers).get('x-forwarded-for')
 
35
  if pose_image is None:
36
  return None, "no pose image found !", ""
37
 
 
 
 
 
38
  # pose_id, cloth_id = pose_id['label'], cloth_id['label']
39
  # print(pose_id, cloth_id, size, (pose_image is None), len(pose_id)>0)
40
  if len(pose_id)>0:
 
44
  # res = cv2.imread(res)
45
  return res, "Done! Use the pre-run results directly, the cloth size does not take effect ", mk_guide
46
  else:
47
+
48
+ faces = face_detector.detect_faces(pose_image[:,:,::-1])
49
+ if len(faces)==0:
50
+ print(client_ip, 'faces num is 0! ', flush=True)
51
+ return None, "Failed !!! No face detected !!! please upload a human photo!!! Not clothing photo!!!", ""
52
+
53
  try:
54
  client_ip = request.client.host
55
  x_forwarded_for = dict(request.headers).get('x-forwarded-for')