Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
import matplotlib.pyplot as plt
|
3 |
-
from sentence_transformers import
|
|
|
4 |
|
5 |
def predict(im1, im2):
|
6 |
model = SentenceTransformer('sentence-transformers/clip-ViT-B-16')
|
7 |
emb = model.encode([im1, im2])
|
8 |
-
sim =
|
9 |
if sim > .90:
|
10 |
return sim, "SAME PERSON, UNLOCK PHONE"
|
11 |
else:
|
|
|
1 |
import gradio as gr
|
2 |
import matplotlib.pyplot as plt
|
3 |
+
from sentence_transformers import SentenceTransformer
|
4 |
+
from sklearn.metrics.pairwise import cosine_similarity
|
5 |
|
6 |
def predict(im1, im2):
|
7 |
model = SentenceTransformer('sentence-transformers/clip-ViT-B-16')
|
8 |
emb = model.encode([im1, im2])
|
9 |
+
sim = cosine_similarity(emb)[0][1]
|
10 |
if sim > .90:
|
11 |
return sim, "SAME PERSON, UNLOCK PHONE"
|
12 |
else:
|