I have some doubt:
I am getting the Error as:
Argument of type "tuple[Any, NDArray[Any] | Unbound, NDArray[Any] | Unbound] | tuple[Any, NDArray[Any] | Unbound] | Any | tuple[Any | Unknown, Unknown, Unknown] | tuple[Any | Unknown, Unknown] | Unknown" cannot be assigned to parameter "x" of type "ConvertibleToFloat" in function "__new__"
  Type "tuple[Any, NDArray[Any] | Unbound, NDArray[Any] | Unbound] | tuple[Any, NDArray[Any] | Unbound] | Any | tuple[Any | Unknown, Unknown, Unknown] | tuple[Any | Unknown, Unknown] | Unknown" is not assignable to type "ConvertibleToFloat"
    Type "tuple[Any, NDArray[Any] | Unbound, NDArray[Any] | Unbound]" is not assignable to type "ConvertibleToFloat"
      "tuple[Any, NDArray[Any] | Unbound, NDArray[Any] | Unbound]" is not assignable to "str"
      "tuple[Any, NDArray[Any] | Unbound, NDArray[Any] | Unbound]" is incompatible with protocol "Buffer"
        "__buffer__" is not present
      "tuple[Any, NDArray[Any] | Unbound, NDArray[Any] | Unbound]" is incompatible with protocol "SupportsFloat"
        "__float__" is not present
      "tuple[Any, NDArray[Any] | Unbound, NDArray[Any] | Unbound]" is incompatible with protocol "SupportsIndex"
...
code section is as:
def calculating_similarity_score(self, encoded_img_1, encoded_img_2):
print(f"calling similarity function .. SUCCESS .. ")
print(f"decoding image .. ")
decoded_img_1 = base64.b64decode(encoded_img_1)
decoded_img_2 = base64.b64decode(encoded_img_2)
print(f"decoding image .. SUCCESS ..")
# Read the images
print(f"Image reading ")
img_1 = imageio.imread(decoded_img_1)
img_2 = imageio.imread(decoded_img_2)
print(f"image reading .. SUCCESS .. ")
# Print shapes to diagnose the issue
print(f"img_1 shape = {img_1.shape}")
print(f"img_2 shape = {img_2.shape}")
# ")
# Convert to float
img_1_as = img_as_float(img_1)
img_2_as = img_as_float(img_2)
print(f"converted image into the float ")
print(f"calculating score .. ")
# Calculate SSIM without the full parameter
if len(img_1_as.shape) == 3 and img_1_as.shape[2] == 3:
# For color images, specify the channel_axis
ssim_score = ssim(img_1_as, img_2_as, data_range=img_1_as.max() - img_1_as.min(), channel_axis=2, full=False, gradient=False)
else:
# For grayscale images
ssim_score = ssim(img_1_as, img_2_as, data_range=img_1_as.max() - img_1_as.min())
print(f"calculating image .. SUCCESS .. ")
return ssim_score
so upon returning the value form this function I and adding the operator on it like:
if returned_ssim_score > 0.80: ## then for this line it gives me the above first one error.
but when I am printing this returned value then it is working fine like showing me the v alue as: 0.98745673...
so can you help me with this