escottyp commited on
Commit
6988e02
·
1 Parent(s): 546decd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,11 +1,12 @@
1
  import gradio as gr
2
  import matplotlib.pyplot as plt
3
- from sentence_transformers import util, SentenceTransformer
 
4
 
5
  def predict(im1, im2):
6
  model = SentenceTransformer('sentence-transformers/clip-ViT-B-16')
7
  emb = model.encode([im1, im2])
8
- sim = util.cos_sim(emb)[0][1]
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: