Update app.py
Browse files
app.py
CHANGED
@@ -28,8 +28,8 @@ def calculate_text_similarity(text1, text2):
|
|
28 |
outputs_text1 = model(**encoded_text1)
|
29 |
outputs_text2 = model(**encoded_text2)
|
30 |
|
31 |
-
embeddings_text1 = outputs_text1.
|
32 |
-
embeddings_text2 = outputs_text2.
|
33 |
|
34 |
text_similarity = ssim(embeddings_text1.numpy(), embeddings_text2.numpy())
|
35 |
|
@@ -72,6 +72,7 @@ def prevent_trademark_conflict(trademark1, trademark2):
|
|
72 |
return similarity_scores
|
73 |
|
74 |
|
|
|
75 |
trademark_comparison_interface = gr.Interface(
|
76 |
fn=prevent_trademark_conflict,
|
77 |
inputs=[
|
@@ -80,9 +81,8 @@ trademark_comparison_interface = gr.Interface(
|
|
80 |
],
|
81 |
outputs="text",
|
82 |
title="Trademark Comparison",
|
83 |
-
description="Compare two trademarks based on SSIM and
|
84 |
)
|
85 |
|
86 |
# Launch the interface
|
87 |
trademark_comparison_interface.launch()
|
88 |
-
|
|
|
28 |
outputs_text1 = model(**encoded_text1)
|
29 |
outputs_text2 = model(**encoded_text2)
|
30 |
|
31 |
+
embeddings_text1 = outputs_text1.pooler_output.squeeze(0)
|
32 |
+
embeddings_text2 = outputs_text2.pooler_output.squeeze(0)
|
33 |
|
34 |
text_similarity = ssim(embeddings_text1.numpy(), embeddings_text2.numpy())
|
35 |
|
|
|
72 |
return similarity_scores
|
73 |
|
74 |
|
75 |
+
# Interface
|
76 |
trademark_comparison_interface = gr.Interface(
|
77 |
fn=prevent_trademark_conflict,
|
78 |
inputs=[
|
|
|
81 |
],
|
82 |
outputs="text",
|
83 |
title="Trademark Comparison",
|
84 |
+
description="Compare two trademarks based on SSIM, text similarity, and color similarity.",
|
85 |
)
|
86 |
|
87 |
# Launch the interface
|
88 |
trademark_comparison_interface.launch()
|
|