BenjiELCA commited on
Commit
d32223f
·
1 Parent(s): e508e94

test loading for image

Browse files
Files changed (1) hide show
  1. app.py +18 -17
app.py CHANGED
@@ -274,7 +274,7 @@ def main():
274
  st.image("./images/banner.png", use_column_width=True)
275
 
276
  # Sidebar content
277
- st.sidebar.header("This BPMN model recognition by AI is proposed by ELCA in collaboration with EPFL.")
278
  st.sidebar.subheader("Instructions:")
279
  st.sidebar.text("1. Upload you image")
280
  st.sidebar.text("2. Crop the image \n (try to put the BPMN diagram \n in the center of the image)")
@@ -282,7 +282,7 @@ def main():
282
  st.sidebar.text("4. Set the scale for the XML file \n (default is 1.0)")
283
  st.sidebar.text("5. Click on 'Launch Prediction'")
284
 
285
- st.sidebar.subheader("You can close the sidebar")
286
 
287
  # Set the title of the app
288
  st.title("BPMN model recognition demo")
@@ -311,22 +311,23 @@ def main():
311
 
312
  # Display the uploaded image if the user has uploaded an image
313
  if uploaded_file is not None:
314
- original_image = get_image(uploaded_file)
315
- col1, col2 = st.columns(2)
316
-
317
- # Create a cropper to allow the user to crop the image and display the cropped image
318
- with col1:
319
- cropped_image = st_cropper(original_image, realtime_update=True, box_color='#0000FF', should_resize_image=True, default_coords=(30, original_image.size[0]-30, 30, original_image.size[1]-30))
320
- with col2:
321
- st.image(cropped_image, caption="Cropped Image", use_column_width=False, width=500)
322
-
323
- # Display the options for the user to set the score threshold and scale
324
- if cropped_image is not None:
325
- col1, col2, col3 = st.columns(3)
326
- with col1:
327
- score_threshold = st.slider("Set score threshold for prediction", min_value=0.0, max_value=1.0, value=0.5, step=0.05)
328
  with col2:
329
- st.session_state.scale = st.slider("Set scale for XML file", min_value=0.1, max_value=2.0, value=1.0, step=0.1)
 
 
 
 
 
 
 
 
330
 
331
  # Launch the prediction when the user clicks the button
332
  if st.button("Launch Prediction"):
 
274
  st.image("./images/banner.png", use_column_width=True)
275
 
276
  # Sidebar content
277
+ st.sidebar.header("This BPMN AI model recognition is proposed by ELCA in collaboration with EPFL.")
278
  st.sidebar.subheader("Instructions:")
279
  st.sidebar.text("1. Upload you image")
280
  st.sidebar.text("2. Crop the image \n (try to put the BPMN diagram \n in the center of the image)")
 
282
  st.sidebar.text("4. Set the scale for the XML file \n (default is 1.0)")
283
  st.sidebar.text("5. Click on 'Launch Prediction'")
284
 
285
+ st.sidebar.subheader("You can close this sidebar")
286
 
287
  # Set the title of the app
288
  st.title("BPMN model recognition demo")
 
311
 
312
  # Display the uploaded image if the user has uploaded an image
313
  if uploaded_file is not None:
314
+ with st.spinner('wait for image...'):
315
+ original_image = get_image(uploaded_file)
316
+ col1, col2 = st.columns(2)
317
+
318
+ # Create a cropper to allow the user to crop the image and display the cropped image
319
+ with col1:
320
+ cropped_image = st_cropper(original_image, realtime_update=True, box_color='#0000FF', should_resize_image=True, default_coords=(30, original_image.size[0]-30, 30, original_image.size[1]-30))
 
 
 
 
 
 
 
321
  with col2:
322
+ st.image(cropped_image, caption="Cropped Image", use_column_width=False, width=500)
323
+
324
+ # Display the options for the user to set the score threshold and scale
325
+ if cropped_image is not None:
326
+ col1, col2, col3 = st.columns(3)
327
+ with col1:
328
+ score_threshold = st.slider("Set score threshold for prediction", min_value=0.0, max_value=1.0, value=0.5, step=0.05)
329
+ with col2:
330
+ st.session_state.scale = st.slider("Set scale for XML file", min_value=0.1, max_value=2.0, value=1.0, step=0.1)
331
 
332
  # Launch the prediction when the user clicks the button
333
  if st.button("Launch Prediction"):