BenjiELCA commited on
Commit
03986c0
·
1 Parent(s): 85cd155

xml update the modeler

Browse files
Files changed (2) hide show
  1. htlm_webpage.py +16 -12
  2. train.py +1 -1
htlm_webpage.py CHANGED
@@ -65,7 +65,7 @@ def display_bpmn_xml(bpmn_xml):
65
  <div id="button-container">
66
  <button id="save-button">Save as BPMN</button>
67
  <button id="download-button">Save as XML</button>
68
- <button id="download-button">Save as Vizi (not available for now)</button>
69
  </div>
70
  <div id="canvas-container">
71
  <div id="canvas"></div>
@@ -103,15 +103,20 @@ def display_bpmn_xml(bpmn_xml):
103
  }}
104
 
105
  async function downloadXML() {{
106
- const xml = `{bpmn_xml}`;
107
- const blob = new Blob([xml], {{ type: 'text/xml' }});
108
- const url = URL.createObjectURL(blob);
109
- const a = document.createElement('a');
110
- a.href = url;
111
- a.download = 'diagram.xml';
112
- document.body.appendChild(a);
113
- a.click();
114
- document.body.removeChild(a);
 
 
 
 
 
115
  }}
116
 
117
  document.getElementById('save-button').addEventListener('click', saveDiagram);
@@ -137,5 +142,4 @@ def display_bpmn_xml(bpmn_xml):
137
  </html>
138
  """
139
 
140
-
141
- components.html(html_template, height=1000, width=1500)
 
65
  <div id="button-container">
66
  <button id="save-button">Save as BPMN</button>
67
  <button id="download-button">Save as XML</button>
68
+ <button id="save-button">Save as Method&Style (not available now)</button>
69
  </div>
70
  <div id="canvas-container">
71
  <div id="canvas"></div>
 
103
  }}
104
 
105
  async function downloadXML() {{
106
+ try {{
107
+ const result = await bpmnModeler.saveXML({{ format: true }});
108
+ const xml = result.xml;
109
+ const blob = new Blob([xml], {{ type: 'text/xml' }});
110
+ const url = URL.createObjectURL(blob);
111
+ const a = document.createElement('a');
112
+ a.href = url;
113
+ a.download = 'diagram.xml';
114
+ document.body.appendChild(a);
115
+ a.click();
116
+ document.body.removeChild(a);
117
+ }} catch (err) {{
118
+ console.error('Error downloading XML', err);
119
+ }}
120
  }}
121
 
122
  document.getElementById('save-button').addEventListener('click', saveDiagram);
 
142
  </html>
143
  """
144
 
145
+ components.html(html_template, height=1000, width=1500)
 
train.py CHANGED
@@ -44,7 +44,7 @@ def get_arrow_model(num_classes, num_keypoints=2):
44
  if device == torch.device('cuda'):
45
  model = keypointrcnn_resnet50_fpn(weights=KeypointRCNN_ResNet50_FPN_Weights.COCO_V1)
46
  else:
47
- model = keypointrcnn_resnet50_fpn(weights=False)
48
 
49
  # Get the number of input features for the classifier in the box predictor.
50
  in_features = model.roi_heads.box_predictor.cls_score.in_features
 
44
  if device == torch.device('cuda'):
45
  model = keypointrcnn_resnet50_fpn(weights=KeypointRCNN_ResNet50_FPN_Weights.COCO_V1)
46
  else:
47
+ model = keypointrcnn_resnet50_fpn(weights=None)
48
 
49
  # Get the number of input features for the classifier in the box predictor.
50
  in_features = model.roi_heads.box_predictor.cls_score.in_features