selfitcamera
commited on
Commit
•
e28886c
1
Parent(s):
a14828a
update
Browse files
app.py
CHANGED
@@ -44,17 +44,18 @@ def onClick(cloth_id, pose_image, pose_id, size, request: gr.Request):
|
|
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')
|
56 |
if x_forwarded_for:
|
57 |
client_ip = x_forwarded_for
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
timeId = int( str(time.time()).replace(".", "") )+random.randint(1000, 9999)
|
59 |
isUpload = upload_pose_img(ApiUrl, OpenId, ApiKey, client_ip, timeId, pose_image)
|
60 |
if isUpload==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 |
try:
|
48 |
client_ip = request.client.host
|
49 |
x_forwarded_for = dict(request.headers).get('x-forwarded-for')
|
50 |
if x_forwarded_for:
|
51 |
client_ip = x_forwarded_for
|
52 |
+
|
53 |
+
faces = face_detector.detect_faces(pose_image[:,:,::-1])
|
54 |
+
if len(faces)==0:
|
55 |
+
client_ip = request.client.host
|
56 |
+
print(client_ip, 'faces num is 0! ', flush=True)
|
57 |
+
return None, "Failed !!! No face detected !!! please upload a human photo!!! Not clothing photo!!!", ""
|
58 |
+
|
59 |
timeId = int( str(time.time()).replace(".", "") )+random.randint(1000, 9999)
|
60 |
isUpload = upload_pose_img(ApiUrl, OpenId, ApiKey, client_ip, timeId, pose_image)
|
61 |
if isUpload==0:
|