Spaces:
Runtime error
Runtime error
Adding beauty touch to app
Browse files
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 |
-
|
|
|
19 |
|
20 |
-
iface = gr.Interface(fn=get_similarity,
|
|
|
|
|
|
|
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()
|