Spaces:
Sleeping
Sleeping
Daniel Cerda Escobar commited on
Commit ·
7257ea0
1
Parent(s): bc4d2d3
Resize Image Dynamically
Browse files
app.py
CHANGED
|
@@ -157,36 +157,40 @@ if submit:
|
|
| 157 |
|
| 158 |
st.write('##')
|
| 159 |
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
#st.markdown(f"#### Object Detection Result")
|
| 191 |
#with st.container(border = True):
|
| 192 |
# static_component = image_comparison(
|
|
|
|
| 157 |
|
| 158 |
st.write('##')
|
| 159 |
|
| 160 |
+
# Optional: Add a subtitle for extra description
|
| 161 |
+
st.subheader("Compare the two images below:")
|
| 162 |
+
|
| 163 |
+
# Use custom CSS to make the image comparison widget responsive
|
| 164 |
+
st.markdown(
|
| 165 |
+
"""
|
| 166 |
+
<style>
|
| 167 |
+
/* Target the container of the image comparison widget */
|
| 168 |
+
.stImageComparison > div {
|
| 169 |
+
width: 100%; /* Make the container responsive */
|
| 170 |
+
max-width: 90vw; /* Max width as 90% of the viewport width */
|
| 171 |
+
margin: 0 auto; /* Center the widget */
|
| 172 |
+
height: auto; /* Ensure aspect ratio is maintained */
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
/* Optional: Add additional styling, like border */
|
| 176 |
+
.stImageComparison > div img {
|
| 177 |
+
width: 100%; /* Images take 100% width of the container */
|
| 178 |
+
height: auto; /* Maintain the aspect ratio */
|
| 179 |
+
border-radius: 8px; /* Optional: Rounded corners */
|
| 180 |
+
}
|
| 181 |
+
</style>
|
| 182 |
+
""",
|
| 183 |
+
unsafe_allow_html=True
|
| 184 |
+
)
|
| 185 |
+
|
| 186 |
+
# Display the image comparison widget with the resized images
|
| 187 |
+
image_comparison(
|
| 188 |
+
st.session_state["output_1"],
|
| 189 |
+
st.session_state["output_2"]
|
| 190 |
+
)
|
| 191 |
+
|
| 192 |
+
#col1, col2, col3 = st.columns([1, 10, 1], gap='small')
|
| 193 |
+
#with col2:
|
| 194 |
#st.markdown(f"#### Object Detection Result")
|
| 195 |
#with st.container(border = True):
|
| 196 |
# static_component = image_comparison(
|