BenjiELCA commited on
Commit
962bd18
1 Parent(s): cb5d656

add spinner for waiting

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -311,7 +311,7 @@ def main():
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
 
@@ -335,19 +335,20 @@ def main():
335
  with st.spinner('Processing...'):
336
  perform_inference(model_object, model_arrow, st.session_state.crop_image, score_threshold)
337
  st.session_state.prediction = modif_box_pos(st.session_state.prediction, object_dict)
338
-
339
  print('Detection completed!')
340
 
341
 
342
  # If the prediction has been made and the user has uploaded an image, display the options for the user to annotate the image
343
  if 'prediction' in st.session_state and uploaded_file is not None:
344
- st.success('Detection completed!')
345
- display_options(st.session_state.crop_image, score_threshold)
 
346
 
347
  #if st.session_state.prediction_up==True:
348
- st.session_state.bpmn_xml = create_XML(st.session_state.prediction.copy(), st.session_state.text_mapping, st.session_state.scale)
349
-
350
- display_bpmn_xml(st.session_state.bpmn_xml)
351
 
352
  # Force garbage collection after display
353
  gc.collect()
 
311
 
312
  # Display the uploaded image if the user has uploaded an image
313
  if uploaded_file is not None:
314
+ with st.spinner('Waiting for image display...'):
315
  original_image = get_image(uploaded_file)
316
  col1, col2 = st.columns(2)
317
 
 
335
  with st.spinner('Processing...'):
336
  perform_inference(model_object, model_arrow, st.session_state.crop_image, score_threshold)
337
  st.session_state.prediction = modif_box_pos(st.session_state.prediction, object_dict)
338
+ st.success('Detection completed!')
339
  print('Detection completed!')
340
 
341
 
342
  # If the prediction has been made and the user has uploaded an image, display the options for the user to annotate the image
343
  if 'prediction' in st.session_state and uploaded_file is not None:
344
+
345
+ with st.spinner('Waiting for result display...'):
346
+ display_options(st.session_state.crop_image, score_threshold)
347
 
348
  #if st.session_state.prediction_up==True:
349
+ with st.spinner('Waiting for BPMN modeler...'):
350
+ st.session_state.bpmn_xml = create_XML(st.session_state.prediction.copy(), st.session_state.text_mapping, st.session_state.scale)
351
+ display_bpmn_xml(st.session_state.bpmn_xml)
352
 
353
  # Force garbage collection after display
354
  gc.collect()