Update app.py
Browse files
app.py
CHANGED
|
@@ -38,7 +38,12 @@ def compare_colors(trademark1, trademark2):
|
|
| 38 |
|
| 39 |
# Function to compare trademarks based on multiple aspects
|
| 40 |
def compare_trademarks(trademark1, trademark2):
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
text_similarity = compare_text(trademark1, trademark2)
|
| 43 |
color_similarity = compare_colors(trademark1, trademark2)
|
| 44 |
|
|
@@ -64,6 +69,7 @@ iface = gr.Interface(
|
|
| 64 |
],
|
| 65 |
outputs="text",
|
| 66 |
title="Trademark Conflict Prevention",
|
|
|
|
| 67 |
description="Upload two trademark images to prevent conflict."
|
| 68 |
)
|
| 69 |
|
|
|
|
| 38 |
|
| 39 |
# Function to compare trademarks based on multiple aspects
|
| 40 |
def compare_trademarks(trademark1, trademark2):
|
| 41 |
+
# Resize images to a consistent size
|
| 42 |
+
size = (300, 300)
|
| 43 |
+
trademark1_resized = trademark1.resize(size)
|
| 44 |
+
trademark2_resized = trademark2.resize(size)
|
| 45 |
+
|
| 46 |
+
ssim_score = calculate_ssim(np.array(trademark1_resized), np.array(trademark2_resized))
|
| 47 |
text_similarity = compare_text(trademark1, trademark2)
|
| 48 |
color_similarity = compare_colors(trademark1, trademark2)
|
| 49 |
|
|
|
|
| 69 |
],
|
| 70 |
outputs="text",
|
| 71 |
title="Trademark Conflict Prevention",
|
| 72 |
+
|
| 73 |
description="Upload two trademark images to prevent conflict."
|
| 74 |
)
|
| 75 |
|