aditya-s-yadav commited on
Commit
7bd9e03
·
verified ·
1 Parent(s): d7b50e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -16
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 both images and results side by side
47
- col1, col2 = st.columns(2)
48
- with col1:
49
- st.image(img1.squeeze(0).cpu().permute(1, 2, 0), caption='First Signature Image', use_container_width=True)
50
- with col2:
51
- st.image(img2.squeeze(0).cpu().permute(1, 2, 0), caption='Second Signature Image', use_container_width=True)
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**.")