Daniel Cerda Escobar commited on
Commit
bc4d2d3
·
1 Parent(s): 394232e

Resize Image Dynamically

Browse files
Files changed (1) hide show
  1. app.py +38 -10
app.py CHANGED
@@ -159,16 +159,44 @@ st.write('##')
159
 
160
  col1, col2, col3 = st.columns([1, 10, 1], gap='small')
161
  with col2:
162
- st.markdown(f"#### Object Detection Result")
163
- with st.container(border = True):
164
- static_component = image_comparison(
165
- img1=st.session_state["output_1"],
166
- img2=st.session_state["output_2"],
167
- label1='Raw Diagram',
168
- label2='Inference Prediction',
169
- width=col2.width,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  starting_position=50,
171
  show_labels=True,
172
  make_responsive=True,
173
- in_memory=True,
174
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
 
160
  col1, col2, col3 = st.columns([1, 10, 1], gap='small')
161
  with col2:
162
+ st.subheader('Object Prediction Result')
163
+ # Add custom CSS to make images responsive and add a border
164
+ st.markdown(
165
+ """
166
+ <style>
167
+ .stImageComparison > div {
168
+ max-width: 100%;
169
+ height: auto;
170
+ border: 3px solid #000; /* Add a black border with 3px thickness */
171
+ border-radius: 10px; /* Optional: Add rounded corners to the border */
172
+ padding: 5px; /* Optional: Add padding around the images */
173
+ }
174
+ </style>
175
+ """,
176
+ unsafe_allow_html=True
177
+ )
178
+ # Display image comparison with custom width and labels
179
+ image_comparison(
180
+ st.session_state["output_1"],
181
+ st.session_state["output_2"],
182
+ label1="Raw Diagram",
183
+ label2="Inference Prediction",
184
  starting_position=50,
185
  show_labels=True,
186
  make_responsive=True,
187
+ in_memory=True
188
+ )
189
+
190
+ #st.markdown(f"#### Object Detection Result")
191
+ #with st.container(border = True):
192
+ # static_component = image_comparison(
193
+ # img1=st.session_state["output_1"],
194
+ # img2=st.session_state["output_2"],
195
+ # label1='Raw Diagram',
196
+ # label2='Inference Prediction',
197
+ # width=col2.width,
198
+ # starting_position=50,
199
+ # show_labels=True,
200
+ # make_responsive=True,
201
+ # in_memory=True,
202
+ # )