Daniel Cerda Escobar commited on
Commit
3a93a98
·
1 Parent(s): 7257ea0

Resize Image Dynamically

Browse files
Files changed (1) hide show
  1. app.py +14 -9
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
- /* 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
  """,
 
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
  """,