BenjiELCA commited on
Commit
a37d48b
Β·
1 Parent(s): fc2d014
Files changed (1) hide show
  1. app.py +26 -17
app.py CHANGED
@@ -6,9 +6,6 @@ import numpy as np
6
  from modules.streamlit_utils import *
7
 
8
 
9
-
10
-
11
-
12
  def main():
13
  is_mobile, screen_width = configure_page()
14
  display_banner(is_mobile)
@@ -23,34 +20,46 @@ def main():
23
  if uploaded_file is not None:
24
  cropped_image = display_image(uploaded_file, screen_width, is_mobile)
25
 
26
- if cropped_image is not None:
27
  get_score_threshold(is_mobile)
 
28
  if st.button("πŸš€ Launch Prediction"):
29
  st.session_state.image = launch_prediction(cropped_image, st.session_state.score_threshold, is_mobile, screen_width)
30
  st.session_state.original_prediction = st.session_state.prediction.copy()
31
  st.rerun()
32
-
33
- if 'prediction' in st.session_state and uploaded_file:
34
- #if st.button("πŸ”„ Refresh image"):
35
- #st.rerun()
36
 
 
 
 
 
 
 
 
37
  if st.session_state.image != cropped_image:
38
  print('Image has changed')
39
- #delete the prediction
40
  del st.session_state.prediction
41
  return
42
 
43
- with st.expander("Show result of prediction"):
44
- with st.spinner('Waiting for result display...'):
45
- display_options(st.session_state.crop_image, st.session_state.score_threshold, is_mobile, int(5/6 * screen_width))
 
46
 
47
  if not is_mobile:
48
- modify_results()
 
49
 
50
- modeler_options(is_mobile)
51
-
52
-
53
- display_bpmn_modeler(is_mobile, screen_width)
 
 
 
 
 
 
54
 
55
  gc.collect()
56
 
 
6
  from modules.streamlit_utils import *
7
 
8
 
 
 
 
9
  def main():
10
  is_mobile, screen_width = configure_page()
11
  display_banner(is_mobile)
 
20
  if uploaded_file is not None:
21
  cropped_image = display_image(uploaded_file, screen_width, is_mobile)
22
 
23
+ if uploaded_file is not None:
24
  get_score_threshold(is_mobile)
25
+
26
  if st.button("πŸš€ Launch Prediction"):
27
  st.session_state.image = launch_prediction(cropped_image, st.session_state.score_threshold, is_mobile, screen_width)
28
  st.session_state.original_prediction = st.session_state.prediction.copy()
29
  st.rerun()
 
 
 
 
30
 
31
+ # Create placeholders for all sections
32
+ prediction_result_placeholder = st.empty()
33
+ additional_options_placeholder = st.empty()
34
+ modeler_placeholder = st.empty()
35
+
36
+
37
+ if 'prediction' in st.session_state and uploaded_file:
38
  if st.session_state.image != cropped_image:
39
  print('Image has changed')
40
+ # Delete the prediction
41
  del st.session_state.prediction
42
  return
43
 
44
+ with prediction_result_placeholder.container():
45
+ with st.expander("Show result of prediction"):
46
+ with st.spinner('Waiting for result display...'):
47
+ display_options(st.session_state.crop_image, st.session_state.score_threshold, is_mobile, int(5/6 * screen_width))
48
 
49
  if not is_mobile:
50
+ with additional_options_placeholder.container():
51
+ modify_results()
52
 
53
+ with modeler_placeholder.container():
54
+ modeler_options(is_mobile)
55
+ display_bpmn_modeler(is_mobile, screen_width)
56
+ else:
57
+ prediction_result_placeholder.empty()
58
+ additional_options_placeholder.empty()
59
+ modeler_placeholder.empty()
60
+ # Create a lot of space for scrolling
61
+ for _ in range(50):
62
+ st.text("")
63
 
64
  gc.collect()
65