Spaces:
Build error
Build error
FrancescaFr
commited on
Commit
•
378ce0f
1
Parent(s):
650e24d
Update app.py
Browse files
app.py
CHANGED
@@ -7,16 +7,15 @@ def predict(im1, im2):
|
|
7 |
embeddings = model.encode([im1,im2])
|
8 |
similarities = cosine_similarity(embeddings)
|
9 |
sim = similarities[0][1]
|
10 |
-
|
11 |
if sim > .8:
|
12 |
return sim, "SAME PERSON, UNLOCK PHONE"
|
13 |
else:
|
14 |
return sim, "DIFFERENT PEOPLE, DON'T UNLOCK"
|
15 |
|
16 |
interface = gr.Interface(fn=predict,
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
)
|
22 |
interface.launch(debug=True)
|
|
|
7 |
embeddings = model.encode([im1,im2])
|
8 |
similarities = cosine_similarity(embeddings)
|
9 |
sim = similarities[0][1]
|
10 |
+
|
11 |
if sim > .8:
|
12 |
return sim, "SAME PERSON, UNLOCK PHONE"
|
13 |
else:
|
14 |
return sim, "DIFFERENT PEOPLE, DON'T UNLOCK"
|
15 |
|
16 |
interface = gr.Interface(fn=predict,
|
17 |
+
inputs= [gr.Image(type="pil", source="webcam"),
|
18 |
+
gr.Image(type="pil", source="webcam")],
|
19 |
+
outputs= [gr.Number(label="Similarity"),
|
20 |
+
gr.Textbox(label="Message")])
|
|
|
21 |
interface.launch(debug=True)
|