Update app.py
Browse files
app.py
CHANGED
@@ -31,16 +31,18 @@ def calculate_similarity(img1, img2):
|
|
31 |
def image_similarity(img1, img2):
|
32 |
img1 = img1.astype(np.uint8)
|
33 |
img2 = img2.astype(np.uint8)
|
34 |
-
ssim_score = calculate_similarity(img1, img2)
|
35 |
|
36 |
-
# Remove text from images
|
37 |
img1_processed = remove_text(img1)
|
38 |
img2_processed = remove_text(img2)
|
39 |
|
40 |
-
# Calculate similarity score
|
41 |
-
|
|
|
|
|
|
|
42 |
|
43 |
-
result = f"SSIM Score: {ssim_score:.4f}\nAdditional Score: {additional_score:.4f}"
|
44 |
return result
|
45 |
|
46 |
iface = gr.Interface(
|
|
|
31 |
def image_similarity(img1, img2):
|
32 |
img1 = img1.astype(np.uint8)
|
33 |
img2 = img2.astype(np.uint8)
|
|
|
34 |
|
35 |
+
# Remove text from images
|
36 |
img1_processed = remove_text(img1)
|
37 |
img2_processed = remove_text(img2)
|
38 |
|
39 |
+
# Calculate similarity score based on SSIM
|
40 |
+
ssim_score = calculate_similarity(img1, img2)
|
41 |
+
|
42 |
+
# Calculate similarity score after text removal
|
43 |
+
additional_score = calculate_similarity(img1_processed, img2_processed)
|
44 |
|
45 |
+
result = f"SSIM Score: {ssim_score:.4f}\nAdditional Score (after text removal): {additional_score:.4f}"
|
46 |
return result
|
47 |
|
48 |
iface = gr.Interface(
|