Spaces:
Running
Running
Zhu-FaceOnLive
commited on
Commit
β’
a294f5a
1
Parent(s):
e24b42a
Update app.py
Browse files
app.py
CHANGED
@@ -25,31 +25,30 @@ def search_face(file):
|
|
25 |
except:
|
26 |
raise gr.Error("Please select image file!")
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
res = r.json().get('img_array')
|
54 |
out_array = []
|
55 |
for item in res:
|
|
|
25 |
except:
|
26 |
raise gr.Error("Please select image file!")
|
27 |
|
28 |
+
status_code = r.status_code
|
29 |
+
if status_code == 301:
|
30 |
+
gr.Info("Too many faces in the photo.")
|
31 |
+
elif status_code == 302:
|
32 |
+
gr.Info("Face is not clear enough.")
|
33 |
+
elif status_code == 303:
|
34 |
+
gr.Info("No matches found.")
|
35 |
+
elif status_code == 304:
|
36 |
+
gr.Info("No face in the photo.")
|
37 |
+
elif status_code == 305:
|
38 |
+
gr.Info("Search blocked for privacy issue.")
|
39 |
+
elif status_code == 401:
|
40 |
+
gr.Info("Invalid image format.")
|
41 |
+
elif status_code == 402:
|
42 |
+
gr.Info("Wrong request.")
|
43 |
+
elif status_code == 403:
|
44 |
+
gr.Info("Requests all used in your token.")
|
45 |
+
elif status_code == 404:
|
46 |
+
gr.Info("Timeout, try again.")
|
47 |
+
|
48 |
+
if status_code > 300:
|
49 |
+
return [], count
|
50 |
+
|
51 |
+
try:
|
|
|
52 |
res = r.json().get('img_array')
|
53 |
out_array = []
|
54 |
for item in res:
|