Dimitre commited on
Commit
0957d59
·
1 Parent(s): f91fe8a

Adding beauty touch to app

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -15,7 +15,11 @@ def get_similarity(sentence_a, sentence_b):
15
  embed_a = model([sentence_a])
16
  embed_b = model([sentence_b])
17
  print(embed_a.shape, embed_b.shape)
18
- return cosine_similarity(embed_a, embed_b)
 
19
 
20
- iface = gr.Interface(fn=get_similarity, inputs=["text", "text"], outputs="text")
 
 
 
21
  iface.launch()
 
15
  embed_a = model([sentence_a])
16
  embed_b = model([sentence_b])
17
  print(embed_a.shape, embed_b.shape)
18
+ similarity = cosine_similarity(embed_a, embed_b)[0][0]
19
+ return f"The similarity score between sentence A and sentence B is: {similarity}"
20
 
21
+ iface = gr.Interface(fn=get_similarity,
22
+ inputs=[gr.Textbox(lines=2, placeholder="Sentence A here...", label="Sentence A"),
23
+ gr.Textbox(lines=2, placeholder="Sentence B here...", label="Sentence B")],
24
+ outputs="text")
25
  iface.launch()