Spaces:
Runtime error
Runtime error
Update
Browse files- gradio/demo.py +1 -11
gradio/demo.py
CHANGED
@@ -9,29 +9,20 @@ def compare_face(frame1, frame2):
|
|
9 |
|
10 |
r = requests.post(url=url, files=files)
|
11 |
faces = None
|
12 |
-
log = "----------"
|
13 |
|
14 |
try:
|
15 |
-
log = "++++" + frame1
|
16 |
image1 = Image.open(frame1)
|
17 |
-
log = "1++++" + frame2
|
18 |
image2 = Image.open(frame2)
|
19 |
-
log = "2++++"
|
20 |
|
21 |
face1 = None
|
22 |
face2 = None
|
23 |
-
log = "0------------\n"
|
24 |
-
log += str(r.json()) + "\n"
|
25 |
-
log += str(r.json().get('data')) + "\n"
|
26 |
data = r.json().get('data')
|
27 |
-
log = "1------------" + str(data.get('face1'))
|
28 |
if data.get('face1') is not None:
|
29 |
face = data.get('face1')
|
30 |
x1 = face.get('x1')
|
31 |
y1 = face.get('y1')
|
32 |
x2 = face.get('x2')
|
33 |
y2 = face.get('y2')
|
34 |
-
log = "2------------" + str(x1)
|
35 |
if x1 < 0:
|
36 |
x1 = 0
|
37 |
if y1 < 0:
|
@@ -47,7 +38,6 @@ def compare_face(frame1, frame2):
|
|
47 |
resized_h = 150
|
48 |
|
49 |
face1 = face1.resize((int(resized_w), int(resized_h)))
|
50 |
-
log = "3------------" + str(face1)
|
51 |
|
52 |
if data.get('face2') is not None:
|
53 |
face = data.get('face2')
|
@@ -92,7 +82,7 @@ def compare_face(frame1, frame2):
|
|
92 |
except:
|
93 |
pass
|
94 |
|
95 |
-
return [
|
96 |
|
97 |
with gr.Blocks() as demo:
|
98 |
gr.Markdown(
|
|
|
9 |
|
10 |
r = requests.post(url=url, files=files)
|
11 |
faces = None
|
|
|
12 |
|
13 |
try:
|
|
|
14 |
image1 = Image.open(frame1)
|
|
|
15 |
image2 = Image.open(frame2)
|
|
|
16 |
|
17 |
face1 = None
|
18 |
face2 = None
|
|
|
|
|
|
|
19 |
data = r.json().get('data')
|
|
|
20 |
if data.get('face1') is not None:
|
21 |
face = data.get('face1')
|
22 |
x1 = face.get('x1')
|
23 |
y1 = face.get('y1')
|
24 |
x2 = face.get('x2')
|
25 |
y2 = face.get('y2')
|
|
|
26 |
if x1 < 0:
|
27 |
x1 = 0
|
28 |
if y1 < 0:
|
|
|
38 |
resized_h = 150
|
39 |
|
40 |
face1 = face1.resize((int(resized_w), int(resized_h)))
|
|
|
41 |
|
42 |
if data.get('face2') is not None:
|
43 |
face = data.get('face2')
|
|
|
82 |
except:
|
83 |
pass
|
84 |
|
85 |
+
return [r.json(), faces]
|
86 |
|
87 |
with gr.Blocks() as demo:
|
88 |
gr.Markdown(
|