Update app.py
Browse files
app.py
CHANGED
@@ -10,12 +10,13 @@ def calculate_similarity(img1, img2):
|
|
10 |
return ssim(img1, img2)
|
11 |
|
12 |
# Function to compute similarity scores for all images
|
13 |
-
def
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
return
|
|
|
19 |
|
20 |
# Function to handle the Gradio interface
|
21 |
def image_similarity(target_image, image_list):
|
|
|
10 |
return ssim(img1, img2)
|
11 |
|
12 |
# Function to compute similarity scores for all images
|
13 |
+
def calculate_similarity(img1, img2):
|
14 |
+
if len(img1.shape) == 2:
|
15 |
+
img1 = cv2.cvtColor(img1, cv2.COLOR_GRAY2RGB)
|
16 |
+
if len(img2.shape) == 2:
|
17 |
+
img2 = cv2.cvtColor(img2, cv2.COLOR_GRAY2RGB)
|
18 |
+
return ssim(img1, img2)
|
19 |
+
|
20 |
|
21 |
# Function to handle the Gradio interface
|
22 |
def image_similarity(target_image, image_list):
|