Spaces:
Sleeping
Sleeping
Daniel Cerda Escobar
commited on
Commit
·
3a93a98
1
Parent(s):
7257ea0
Resize Image Dynamically
Browse files
app.py
CHANGED
@@ -160,23 +160,28 @@ st.write('##')
|
|
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 |
-
/*
|
168 |
.stImageComparison > div {
|
169 |
-
width: 100%;
|
170 |
-
max-width: 90vw;
|
171 |
-
margin:
|
172 |
-
|
|
|
|
|
|
|
|
|
173 |
}
|
174 |
|
175 |
-
/*
|
176 |
.stImageComparison > div img {
|
177 |
-
width: 100%;
|
178 |
-
height: auto;
|
179 |
-
border-radius: 8px;
|
180 |
}
|
181 |
</style>
|
182 |
""",
|
|
|
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 |
# Use custom CSS to make the image comparison widget responsive
|
165 |
st.markdown(
|
166 |
"""
|
167 |
<style>
|
168 |
+
/* Style the image comparison container */
|
169 |
.stImageComparison > div {
|
170 |
+
width: 100%; /* Make the container responsive */
|
171 |
+
max-width: 90vw; /* Max width as 90% of the viewport width */
|
172 |
+
margin-left: auto; /* Center the widget horizontally */
|
173 |
+
margin-right: auto;
|
174 |
+
padding: 10px; /* Optional padding around the images */
|
175 |
+
border: 3px solid #000; /* Add a black border around the widget */
|
176 |
+
border-radius: 10px; /* Optional: Rounded corners */
|
177 |
+
background-color: #f7f7f7; /* Optional: Background color for contrast */
|
178 |
}
|
179 |
|
180 |
+
/* Target the images inside the comparison */
|
181 |
.stImageComparison > div img {
|
182 |
+
width: 100%; /* Images take up 100% of the container's width */
|
183 |
+
height: auto; /* Maintain aspect ratio */
|
184 |
+
border-radius: 8px; /* Optional: Rounded corners for images */
|
185 |
}
|
186 |
</style>
|
187 |
""",
|