selfitcamera
commited on
Commit
•
5780146
1
Parent(s):
a38b15c
update
Browse files
app.py
CHANGED
@@ -59,7 +59,13 @@ def onClick(cloth_id, pose_image, pose_id, size, request: gr.Request):
|
|
59 |
client_ip = request.client.host
|
60 |
print(client_ip, 'faces num is 0! ', flush=True)
|
61 |
return None, "Fatal Error !!! No face detected !!! You must upload a human photo!!! Not clothing photo!!!", ""
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
timeId = int( str(time.time()).replace(".", "") )+random.randint(1000, 9999)
|
64 |
isUpload = upload_pose_img(ApiUrl, OpenId, ApiKey, client_ip, timeId, pose_image)
|
65 |
if isUpload==0:
|
|
|
59 |
client_ip = request.client.host
|
60 |
print(client_ip, 'faces num is 0! ', flush=True)
|
61 |
return None, "Fatal Error !!! No face detected !!! You must upload a human photo!!! Not clothing photo!!!", ""
|
62 |
+
else:
|
63 |
+
x, y, w, h = faces[0]["box"]
|
64 |
+
H, W = pose_image.shape[:2]
|
65 |
+
max_face_ratio = 1/2.5
|
66 |
+
if w/W>max_face_ratio or h/H>max_face_ratio:
|
67 |
+
return None, "Fatal Error !!! Headshot is not allowed !!! You must upload a full-body or half-body photo!!!", ""
|
68 |
+
|
69 |
timeId = int( str(time.time()).replace(".", "") )+random.randint(1000, 9999)
|
70 |
isUpload = upload_pose_img(ApiUrl, OpenId, ApiKey, client_ip, timeId, pose_image)
|
71 |
if isUpload==0:
|