Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ from xml.dom import minidom
|
|
8 |
|
9 |
from modules.htlm_webpage import display_bpmn_xml
|
10 |
from modules.utils import class_dict, rescale_boxes
|
11 |
-
from modules.toXML import calculate_pool_bounds, add_diagram_elements, create_bpmn_object, create_flow_element, get_size_elements
|
12 |
from streamlit_cropper import st_cropper
|
13 |
from streamlit_image_select import image_select
|
14 |
from streamlit_js_eval import streamlit_js_eval
|
@@ -17,6 +17,24 @@ from modules.streamlit_utils import get_memory_usage, clear_memory, get_image, l
|
|
17 |
|
18 |
# Function to create a BPMN XML file from prediction results
|
19 |
def create_XML(full_pred, text_mapping, size_scale, scale):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
size_elements = get_size_elements(size_scale)
|
22 |
|
|
|
8 |
|
9 |
from modules.htlm_webpage import display_bpmn_xml
|
10 |
from modules.utils import class_dict, rescale_boxes
|
11 |
+
from modules.toXML import calculate_pool_bounds, add_diagram_elements, create_bpmn_object, create_flow_element, get_size_elements
|
12 |
from streamlit_cropper import st_cropper
|
13 |
from streamlit_image_select import image_select
|
14 |
from streamlit_js_eval import streamlit_js_eval
|
|
|
17 |
|
18 |
# Function to create a BPMN XML file from prediction results
|
19 |
def create_XML(full_pred, text_mapping, size_scale, scale):
|
20 |
+
namespaces = {
|
21 |
+
'bpmn': 'http://www.omg.org/spec/BPMN/20100524/MODEL',
|
22 |
+
'bpmndi': 'http://www.omg.org/spec/BPMN/20100524/DI',
|
23 |
+
'di': 'http://www.omg.org/spec/DD/20100524/DI',
|
24 |
+
'dc': 'http://www.omg.org/spec/DD/20100524/DC',
|
25 |
+
'xsi': 'http://www.w3.org/2001/XMLSchema-instance'
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
definitions = ET.Element('bpmn:definitions', {
|
30 |
+
'xmlns:xsi': namespaces['xsi'],
|
31 |
+
'xmlns:bpmn': namespaces['bpmn'],
|
32 |
+
'xmlns:bpmndi': namespaces['bpmndi'],
|
33 |
+
'xmlns:di': namespaces['di'],
|
34 |
+
'xmlns:dc': namespaces['dc'],
|
35 |
+
'targetNamespace': "http://example.bpmn.com",
|
36 |
+
'id': "simpleExample"
|
37 |
+
})
|
38 |
|
39 |
size_elements = get_size_elements(size_scale)
|
40 |
|