BenjiELCA commited on
Commit
822792a
·
1 Parent(s): 3250939

demo ready

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -70,8 +70,6 @@ def create_XML(full_pred, text_mapping, scale):
70
  'event': (43.2, 43.2),
71
  'parallelGateway': (60, 60),
72
  'sequenceFlow': (180, 12),
73
- 'pool': (300, 120),
74
- 'lane': (240, 120),
75
  'dataObject': (48, 72),
76
  'dataStore': (72, 72),
77
  'subProcess': (144, 108),
@@ -80,8 +78,6 @@ def create_XML(full_pred, text_mapping, scale):
80
  }
81
 
82
 
83
-
84
-
85
  definitions = ET.Element('bpmn:definitions', {
86
  'xmlns:xsi': namespaces['xsi'],
87
  'xmlns:bpmn': namespaces['bpmn'],
@@ -92,6 +88,9 @@ def create_XML(full_pred, text_mapping, scale):
92
  'id': "simpleExample"
93
  })
94
 
 
 
 
95
  # Create BPMN collaboration element
96
  collaboration = ET.SubElement(definitions, 'bpmn:collaboration', id='collaboration_1')
97
 
@@ -286,6 +285,8 @@ def main():
286
  st.sidebar.text("6. You can now see the annotation \n and the BPMN XML result")
287
  st.sidebar.text("7. You can modify and download \n the result in right format")
288
 
 
 
289
  st.sidebar.subheader("You can close this sidebar")
290
 
291
  # Set the title of the app
@@ -334,13 +335,12 @@ def main():
334
  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)
335
 
336
  # Launch the prediction when the user clicks the button
337
- #if st.button("Launch Prediction"):
338
- st.session_state.crop_image = cropped_image
339
- with st.spinner('Processing...'):
340
- perform_inference(model_object, model_arrow, st.session_state.crop_image, score_threshold)
341
- st.session_state.prediction = modif_box_pos(st.session_state.prediction, object_dict)
342
- st.success('Detection completed!')
343
- print('Detection completed!')
344
 
345
 
346
  # If the prediction has been made and the user has uploaded an image, display the options for the user to annotate the image
 
70
  'event': (43.2, 43.2),
71
  'parallelGateway': (60, 60),
72
  'sequenceFlow': (180, 12),
 
 
73
  'dataObject': (48, 72),
74
  'dataStore': (72, 72),
75
  'subProcess': (144, 108),
 
78
  }
79
 
80
 
 
 
81
  definitions = ET.Element('bpmn:definitions', {
82
  'xmlns:xsi': namespaces['xsi'],
83
  'xmlns:bpmn': namespaces['bpmn'],
 
88
  'id': "simpleExample"
89
  })
90
 
91
+ #modify the boxes positions
92
+ full_pred = modif_box_pos(full_pred, size_elements)
93
+
94
  # Create BPMN collaboration element
95
  collaboration = ET.SubElement(definitions, 'bpmn:collaboration', id='collaboration_1')
96
 
 
285
  st.sidebar.text("6. You can now see the annotation \n and the BPMN XML result")
286
  st.sidebar.text("7. You can modify and download \n the result in right format")
287
 
288
+ st.sidebar.text("If there is an error, try to:\n change the score threshold \n recrop the image.")
289
+
290
  st.sidebar.subheader("You can close this sidebar")
291
 
292
  # Set the title of the app
 
335
  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)
336
 
337
  # Launch the prediction when the user clicks the button
338
+ if st.button("Launch Prediction"):
339
+ st.session_state.crop_image = cropped_image
340
+ with st.spinner('Processing...'):
341
+ perform_inference(model_object, model_arrow, st.session_state.crop_image, score_threshold)
342
+ st.session_state.prediction = modif_box_pos(st.session_state.prediction, object_dict)
343
+ st.balloons()
 
344
 
345
 
346
  # If the prediction has been made and the user has uploaded an image, display the options for the user to annotate the image