Spaces:
Running
Running
test to put online the model
Browse files- app.py +9 -0
- modules/toXML.py +0 -2
app.py
CHANGED
|
@@ -24,6 +24,8 @@ from streamlit_cropper import st_cropper
|
|
| 24 |
from streamlit_drawable_canvas import st_canvas
|
| 25 |
from streamlit_image_select import image_select
|
| 26 |
|
|
|
|
|
|
|
| 27 |
|
| 28 |
def get_memory_usage():
|
| 29 |
process = psutil.Process()
|
|
@@ -177,6 +179,13 @@ def load_models():
|
|
| 177 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 178 |
model_arrow.load_state_dict(torch.load(output_arrow, map_location=device))
|
| 179 |
model_object.load_state_dict(torch.load(output_object, map_location=device))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
st.session_state.model_loaded = True
|
| 181 |
st.session_state.model_arrow = model_arrow
|
| 182 |
st.session_state.model_object = model_object
|
|
|
|
| 24 |
from streamlit_drawable_canvas import st_canvas
|
| 25 |
from streamlit_image_select import image_select
|
| 26 |
|
| 27 |
+
from huggingface_hub import PyTorchModelHubMixin
|
| 28 |
+
|
| 29 |
|
| 30 |
def get_memory_usage():
|
| 31 |
process = psutil.Process()
|
|
|
|
| 179 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 180 |
model_arrow.load_state_dict(torch.load(output_arrow, map_location=device))
|
| 181 |
model_object.load_state_dict(torch.load(output_object, map_location=device))
|
| 182 |
+
|
| 183 |
+
# save locally
|
| 184 |
+
model_arrow.save_pretrained("model_arrow")
|
| 185 |
+
|
| 186 |
+
# push to the hub
|
| 187 |
+
model_arrow.push_to_hub("model_arrow")
|
| 188 |
+
|
| 189 |
st.session_state.model_loaded = True
|
| 190 |
st.session_state.model_arrow = model_arrow
|
| 191 |
st.session_state.model_object = model_object
|
modules/toXML.py
CHANGED
|
@@ -129,8 +129,6 @@ def create_bpmn_object(process, bpmnplane, text_mapping, definitions, size, data
|
|
| 129 |
positions = data['boxes']
|
| 130 |
links = data['links']
|
| 131 |
|
| 132 |
-
print(elements)
|
| 133 |
-
|
| 134 |
for i in keep_elements:
|
| 135 |
element_id = elements[i]
|
| 136 |
|
|
|
|
| 129 |
positions = data['boxes']
|
| 130 |
links = data['links']
|
| 131 |
|
|
|
|
|
|
|
| 132 |
for i in keep_elements:
|
| 133 |
element_id = elements[i]
|
| 134 |
|