Spaces:
Running
Running
test mobile
Browse files- app.py +3 -3
- modules/streamlit_utils.py +18 -20
app.py
CHANGED
@@ -42,9 +42,9 @@ def main():
|
|
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 |
-
|
48 |
|
49 |
if not is_mobile:
|
50 |
with additional_options_placeholder.container():
|
|
|
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():
|
modules/streamlit_utils.py
CHANGED
@@ -37,24 +37,6 @@ def clear_memory():
|
|
37 |
st.session_state.clear()
|
38 |
gc.collect()
|
39 |
|
40 |
-
def sidebar():# Sidebar content
|
41 |
-
st.sidebar.header("This BPMN AI model recognition is proposed by: \n ELCA in collaboration with EPFL.")
|
42 |
-
st.sidebar.subheader("Instructions:")
|
43 |
-
st.sidebar.text("1. Upload you image")
|
44 |
-
st.sidebar.text("2. Crop the image \n (try to put the BPMN diagram \n in the center of the image)")
|
45 |
-
st.sidebar.text("3. Set the score threshold \n for prediction (default is 0.5)")
|
46 |
-
st.sidebar.text("4. Click on 'Launch Prediction'")
|
47 |
-
st.sidebar.text("5. You can now see the annotation \n and the BPMN XML result")
|
48 |
-
st.sidebar.text("6. You can change the scale for \n the XML file (default is 1.0)")
|
49 |
-
st.sidebar.text("7. You can modify and download \n the result in right format")
|
50 |
-
|
51 |
-
st.sidebar.subheader("If there is an error, try to:")
|
52 |
-
st.sidebar.text("1. Change the score threshold")
|
53 |
-
st.sidebar.text("2. Re-crop the image by placing\n the BPMN diagram in the center\n of the image")
|
54 |
-
st.sidebar.text("3. Re-Launch the prediction")
|
55 |
-
|
56 |
-
st.sidebar.subheader("You can close this sidebar")
|
57 |
-
|
58 |
|
59 |
# Function to read XML content from a file
|
60 |
def read_xml_file(filepath):
|
@@ -218,7 +200,23 @@ def display_title(is_mobile):
|
|
218 |
st.title(title)
|
219 |
|
220 |
def display_sidebar():
|
221 |
-
sidebar()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
|
223 |
def initialize_session_state():
|
224 |
if 'pool_bboxes' not in st.session_state:
|
@@ -288,7 +286,7 @@ def crop_image(resized_image, original_image):
|
|
288 |
def get_score_threshold(is_mobile):
|
289 |
col1, col2 = st.columns(2)
|
290 |
with col1:
|
291 |
-
st.session_state.score_threshold = st.slider("Set score threshold for prediction", min_value=0.0, max_value=1.0, value=0.5
|
292 |
|
293 |
def launch_prediction(cropped_image, score_threshold, is_mobile, screen_width):
|
294 |
st.session_state.crop_image = cropped_image
|
|
|
37 |
st.session_state.clear()
|
38 |
gc.collect()
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
# Function to read XML content from a file
|
42 |
def read_xml_file(filepath):
|
|
|
200 |
st.title(title)
|
201 |
|
202 |
def display_sidebar():
|
203 |
+
st.sidebar.header("This BPMN AI model recognition is proposed by: \n ELCA in collaboration with EPFL.")
|
204 |
+
st.sidebar.subheader("Instructions:")
|
205 |
+
st.sidebar.text("1. Upload you image")
|
206 |
+
st.sidebar.text("2. Crop the image \n (try to put the BPMN diagram \n in the center of the image)")
|
207 |
+
st.sidebar.text("3. Set the score threshold \n for prediction (default is 0.5)")
|
208 |
+
st.sidebar.text("4. Click on 'Launch Prediction'")
|
209 |
+
st.sidebar.text("5. You can now see the annotation \n and the BPMN XML result")
|
210 |
+
st.sidebar.text("6. You can modify the result \n by clicking on 'Modify Results'")
|
211 |
+
st.sidebar.text("7. You can change the scale for \n the XML file (default is 1.0)")
|
212 |
+
st.sidebar.text("8. You can modify with the modeler \n and download the result in right format")
|
213 |
+
|
214 |
+
st.sidebar.subheader("If there is an error, try to:")
|
215 |
+
st.sidebar.text("1. Change the score threshold")
|
216 |
+
st.sidebar.text("2. Re-crop the image by placing\n the BPMN diagram in the center\n of the image")
|
217 |
+
st.sidebar.text("3. Re-Launch the prediction")
|
218 |
+
|
219 |
+
st.sidebar.subheader("You can close this sidebar")
|
220 |
|
221 |
def initialize_session_state():
|
222 |
if 'pool_bboxes' not in st.session_state:
|
|
|
286 |
def get_score_threshold(is_mobile):
|
287 |
col1, col2 = st.columns(2)
|
288 |
with col1:
|
289 |
+
st.session_state.score_threshold = st.slider("Set score threshold for prediction", min_value=0.0, max_value=1.0, value=0.5, step=0.05)
|
290 |
|
291 |
def launch_prediction(cropped_image, score_threshold, is_mobile, screen_width):
|
292 |
st.session_state.crop_image = cropped_image
|