selfitcamera commited on
Commit
622d4df
1 Parent(s): c0675be
Files changed (2) hide show
  1. app.py +6 -0
  2. requirements.txt +2 -1
app.py CHANGED
@@ -6,6 +6,7 @@ from utils import *
6
  cloth_examples = get_cloth_examples()
7
  pose_examples = get_pose_examples()
8
  tip1, tip2 = get_tips()
 
9
 
10
  # Description
11
  title = r"""
@@ -32,6 +33,11 @@ def onUpload():
32
  def onClick(cloth_id, pose_image, pose_id, size, request: gr.Request):
33
  if pose_image is None:
34
  return None, "no pose image found !", ""
 
 
 
 
 
35
  # pose_id, cloth_id = pose_id['label'], cloth_id['label']
36
  # print(pose_id, cloth_id, size, (pose_image is None), len(pose_id)>0)
37
  if len(pose_id)>0:
 
6
  cloth_examples = get_cloth_examples()
7
  pose_examples = get_pose_examples()
8
  tip1, tip2 = get_tips()
9
+ face_detector = MTCNN()
10
 
11
  # Description
12
  title = r"""
 
33
  def onClick(cloth_id, pose_image, pose_id, size, request: gr.Request):
34
  if pose_image is None:
35
  return None, "no pose image found !", ""
36
+
37
+ faces = face_detector.detect_faces(img)
38
+ if len(faces)==0:
39
+ return None, "Failed !!! No face detected !!! please upload a human photo!!! Not clothing photo!!!", ""
40
+
41
  # pose_id, cloth_id = pose_id['label'], cloth_id['label']
42
  # print(pose_id, cloth_id, size, (pose_image is None), len(pose_id)>0)
43
  if len(pose_id)>0:
requirements.txt CHANGED
@@ -3,4 +3,5 @@ numpy
3
  requests
4
  gradio==3.41.2
5
  gradio-client==0.5.0
6
-
 
 
3
  requests
4
  gradio==3.41.2
5
  gradio-client==0.5.0
6
+ mtcnn
7
+ tensorflow