Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -104,7 +104,7 @@ comparison_image = st.file_uploader(
|
|
| 104 |
"Upload the signature to compare", type=["png", "jpg", "jpeg"]
|
| 105 |
)
|
| 106 |
|
| 107 |
-
def run_model_pipeline(model, original_image, comparison_image, threshold=0.
|
| 108 |
if original_image is not None and comparison_image is not None: # ensure both images are uploaded
|
| 109 |
|
| 110 |
# Preprocess images
|
|
@@ -146,11 +146,15 @@ def run_model_pipeline(model, original_image, comparison_image, threshold=0.5):
|
|
| 146 |
# Visualize heatmaps from extracted model features
|
| 147 |
st.subheader("Feature Heatmaps")
|
| 148 |
col3, col4 = st.columns(2)
|
|
|
|
| 149 |
with col3:
|
| 150 |
-
|
|
|
|
| 151 |
st.pyplot(fig1)
|
|
|
|
| 152 |
with col4:
|
| 153 |
-
|
|
|
|
| 154 |
st.pyplot(fig2)
|
| 155 |
|
| 156 |
else:
|
|
|
|
| 104 |
"Upload the signature to compare", type=["png", "jpg", "jpeg"]
|
| 105 |
)
|
| 106 |
|
| 107 |
+
def run_model_pipeline(model, original_image, comparison_image, threshold=0.3):
|
| 108 |
if original_image is not None and comparison_image is not None: # ensure both images are uploaded
|
| 109 |
|
| 110 |
# Preprocess images
|
|
|
|
| 146 |
# Visualize heatmaps from extracted model features
|
| 147 |
st.subheader("Feature Heatmaps")
|
| 148 |
col3, col4 = st.columns(2)
|
| 149 |
+
|
| 150 |
with col3:
|
| 151 |
+
x1 = rearrange(img1_tensor.float().squeeze(0), 'b h w c -> b c h w')
|
| 152 |
+
fig1 = visualize_heatmap(model, x1)
|
| 153 |
st.pyplot(fig1)
|
| 154 |
+
|
| 155 |
with col4:
|
| 156 |
+
x2 = rearrange(img2_tensor.float().squeeze(0), 'b h w c -> b c h w')
|
| 157 |
+
fig2 = visualize_heatmap(model, x2)
|
| 158 |
st.pyplot(fig2)
|
| 159 |
|
| 160 |
else:
|