Spaces:
Runtime error
Runtime error
Commit
·
4a377c3
1
Parent(s):
76326b4
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ def compare_text(source, target):
|
|
22 |
embedding_source = calculate_embeddings_with_gpt3(source,interval=0)
|
23 |
embedding_target = calculate_embeddings_with_gpt3(target,interval=0)
|
24 |
cosine = np.dot(embedding_target,embedding_source)/(np.linalg.norm(embedding_target)*np.linalg.norm(embedding_source))
|
25 |
-
return { "Similarity": cosine }
|
26 |
|
27 |
import gradio as gr
|
28 |
|
@@ -35,7 +35,8 @@ with gr.Blocks(css=".gradio-container { background-color: white; background-imag
|
|
35 |
btn = gr.Button(value="Compare!", variant="primary")
|
36 |
with gr.Row():
|
37 |
label = gr.Label()
|
38 |
-
|
|
|
39 |
gr.Examples([
|
40 |
["most advanced conversation intelligence and AI powered coaching platform","most advanced conversation intelligence and AI powered coaching platform"],
|
41 |
["Oh, so the quantified platform is one of the most advanced communication intelligence in AI powered coaching systems.","most advanced conversation intelligence and AI powered coaching platform"],
|
|
|
22 |
embedding_source = calculate_embeddings_with_gpt3(source,interval=0)
|
23 |
embedding_target = calculate_embeddings_with_gpt3(target,interval=0)
|
24 |
cosine = np.dot(embedding_target,embedding_source)/(np.linalg.norm(embedding_target)*np.linalg.norm(embedding_source))
|
25 |
+
return { "Similarity": cosine }, round(cosine,3)
|
26 |
|
27 |
import gradio as gr
|
28 |
|
|
|
35 |
btn = gr.Button(value="Compare!", variant="primary")
|
36 |
with gr.Row():
|
37 |
label = gr.Label()
|
38 |
+
score = gr.Textbox(label="Score", interactive=False)
|
39 |
+
btn.click(fn=compare_text, inputs=[source,target], outputs=[label,score])
|
40 |
gr.Examples([
|
41 |
["most advanced conversation intelligence and AI powered coaching platform","most advanced conversation intelligence and AI powered coaching platform"],
|
42 |
["Oh, so the quantified platform is one of the most advanced communication intelligence in AI powered coaching systems.","most advanced conversation intelligence and AI powered coaching platform"],
|