Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -32,6 +32,13 @@ if image1 and image2:
|
|
32 |
img1 = Image.open(image1).convert("RGB")
|
33 |
img2 = Image.open(image2).convert("RGB")
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
# Transform the images before feeding them into the model
|
36 |
img1 = transform(img1).unsqueeze(0).to(device)
|
37 |
img2 = transform(img2).unsqueeze(0).to(device)
|
@@ -43,19 +50,9 @@ if image1 and image2:
|
|
43 |
# Set a threshold for similarity (can be tuned based on model performance)
|
44 |
threshold = 0.5 # You can adjust this threshold based on your model's performance
|
45 |
|
46 |
-
# Display
|
47 |
-
|
48 |
-
|
49 |
-
st.
|
50 |
-
|
51 |
-
st.
|
52 |
-
|
53 |
-
# Display similarity score and interpretation side by side
|
54 |
-
col1, col2 = st.columns(2)
|
55 |
-
with col1:
|
56 |
-
st.success(f'Similarity Score (Euclidean Distance): {euclidean_distance.item():.4f}')
|
57 |
-
with col2:
|
58 |
-
if euclidean_distance.item() < threshold:
|
59 |
-
st.write("The signatures are likely from the **same person**.")
|
60 |
-
else:
|
61 |
-
st.write("The signatures **do not match**, one might be **forged**.")
|
|
|
32 |
img1 = Image.open(image1).convert("RGB")
|
33 |
img2 = Image.open(image2).convert("RGB")
|
34 |
|
35 |
+
# Display images
|
36 |
+
col1, col2 = st.columns(2)
|
37 |
+
with col1:
|
38 |
+
st.image(img1, caption='First Signature Image', use_container_width=True)
|
39 |
+
with col2:
|
40 |
+
st.image(img2, caption='Second Signature Image', use_container_width=True)
|
41 |
+
|
42 |
# Transform the images before feeding them into the model
|
43 |
img1 = transform(img1).unsqueeze(0).to(device)
|
44 |
img2 = transform(img2).unsqueeze(0).to(device)
|
|
|
50 |
# Set a threshold for similarity (can be tuned based on model performance)
|
51 |
threshold = 0.5 # You can adjust this threshold based on your model's performance
|
52 |
|
53 |
+
# Display similarity score and interpretation
|
54 |
+
st.success(f'Similarity Score (Euclidean Distance): {euclidean_distance.item():.4f}')
|
55 |
+
if euclidean_distance.item() < threshold:
|
56 |
+
st.write("The signatures are likely from the **same person**.")
|
57 |
+
else:
|
58 |
+
st.write("The signatures **do not match**, one might be **forged**.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|