Spaces:
Runtime error
Runtime error
Update
Browse files- app.py +1 -1
- gradio/demo.py +6 -5
app.py
CHANGED
@@ -106,7 +106,7 @@ def compare_face():
|
|
106 |
return response
|
107 |
|
108 |
similarity = ttv_compare_feature(feature1, feature2)
|
109 |
-
if similarity > 0.
|
110 |
result = "same person!"
|
111 |
else:
|
112 |
result = "different person!"
|
|
|
106 |
return response
|
107 |
|
108 |
similarity = ttv_compare_feature(feature1, feature2)
|
109 |
+
if similarity > 0.7:
|
110 |
result = "same person!"
|
111 |
else:
|
112 |
result = "different person!"
|
gradio/demo.py
CHANGED
@@ -9,7 +9,7 @@ def compare_face(frame1, frame2):
|
|
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)
|
@@ -38,7 +38,7 @@ def compare_face(frame1, frame2):
|
|
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')
|
44 |
x1 = face.get('x1')
|
@@ -61,8 +61,8 @@ def compare_face(frame1, frame2):
|
|
61 |
resized_h = 150
|
62 |
|
63 |
face2 = face2.resize((int(resized_w), int(resized_h)))
|
64 |
-
|
65 |
-
|
66 |
if face1 is not None and face2 is not None:
|
67 |
new_image = Image.new('RGB',(face1.width + face2.width + 10, 150), (80,80,80))
|
68 |
|
@@ -80,10 +80,11 @@ def compare_face(frame1, frame2):
|
|
80 |
new_image.paste(face2,(face2.width + 10, 0))
|
81 |
faces = new_image.copy()
|
82 |
|
|
|
83 |
except:
|
84 |
pass
|
85 |
|
86 |
-
return [
|
87 |
|
88 |
with gr.Blocks() as demo:
|
89 |
gr.Markdown(
|
|
|
9 |
|
10 |
r = requests.post(url=url, files=files)
|
11 |
faces = None
|
12 |
+
log = "start"
|
13 |
try:
|
14 |
image1 = Image.open(frame1)
|
15 |
image2 = Image.open(frame2)
|
|
|
38 |
resized_h = 150
|
39 |
|
40 |
face1 = face1.resize((int(resized_w), int(resized_h)))
|
41 |
+
log += "2 " + str(face1.width) + "\n"
|
42 |
if data.get('face2') is not None:
|
43 |
face = data.get('face2')
|
44 |
x1 = face.get('x1')
|
|
|
61 |
resized_h = 150
|
62 |
|
63 |
face2 = face2.resize((int(resized_w), int(resized_h)))
|
64 |
+
|
65 |
+
log += "3 " + str(face2.width) + "\n"
|
66 |
if face1 is not None and face2 is not None:
|
67 |
new_image = Image.new('RGB',(face1.width + face2.width + 10, 150), (80,80,80))
|
68 |
|
|
|
80 |
new_image.paste(face2,(face2.width + 10, 0))
|
81 |
faces = new_image.copy()
|
82 |
|
83 |
+
log += "4 " + str(faces)
|
84 |
except:
|
85 |
pass
|
86 |
|
87 |
+
return [{"log": log}, faces]
|
88 |
|
89 |
with gr.Blocks() as demo:
|
90 |
gr.Markdown(
|