Rimjhim Mittal commited on
Commit ·
1ae2624
1
Parent(s): 4f709ff
fixed yaml and bson issue
Browse files
app.py
CHANGED
|
@@ -2,11 +2,11 @@ import streamlit as st, pandas as pd, os, io
|
|
| 2 |
from modeci_mdf.mdf import Model, Graph, Node, Parameter, OutputPort
|
| 3 |
from modeci_mdf.utils import load_mdf_json, load_mdf, load_mdf_yaml
|
| 4 |
from modeci_mdf.execution_engine import EvaluableGraph, EvaluableOutput
|
| 5 |
-
import json
|
| 6 |
import numpy as np
|
| 7 |
import requests
|
| 8 |
st.set_page_config(layout="wide", page_icon="page_icon.png", page_title="Model Description Format", menu_items={
|
| 9 |
-
'Report a bug': "https://github.com/ModECI/MDF/",
|
| 10 |
'About': "ModECI (Model Exchange and Convergence Initiative) is a multi-investigator collaboration that aims to develop a standardized format for exchanging computational models across diverse software platforms and domains of scientific research and technology development, with a particular focus on neuroscience, Machine Learning and Artificial Intelligence. Refer to https://modeci.org/ for more."
|
| 11 |
})
|
| 12 |
|
|
@@ -296,7 +296,11 @@ def load_model_from_content(file_content, file_extension):
|
|
| 296 |
json_data = json.loads(file_content)
|
| 297 |
mdf_model = Model.from_dict(json_data)
|
| 298 |
elif file_extension in ['yaml', 'yml']:
|
| 299 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 300 |
else:
|
| 301 |
st.error("Unsupported file format. Please use JSON or YAML files.")
|
| 302 |
return None
|
|
|
|
| 2 |
from modeci_mdf.mdf import Model, Graph, Node, Parameter, OutputPort
|
| 3 |
from modeci_mdf.utils import load_mdf_json, load_mdf, load_mdf_yaml
|
| 4 |
from modeci_mdf.execution_engine import EvaluableGraph, EvaluableOutput
|
| 5 |
+
import json, yaml, bson
|
| 6 |
import numpy as np
|
| 7 |
import requests
|
| 8 |
st.set_page_config(layout="wide", page_icon="page_icon.png", page_title="Model Description Format", menu_items={
|
| 9 |
+
'Report a bug': "https://github.com/ModECI/MDF-UI/",
|
| 10 |
'About': "ModECI (Model Exchange and Convergence Initiative) is a multi-investigator collaboration that aims to develop a standardized format for exchanging computational models across diverse software platforms and domains of scientific research and technology development, with a particular focus on neuroscience, Machine Learning and Artificial Intelligence. Refer to https://modeci.org/ for more."
|
| 11 |
})
|
| 12 |
|
|
|
|
| 296 |
json_data = json.loads(file_content)
|
| 297 |
mdf_model = Model.from_dict(json_data)
|
| 298 |
elif file_extension in ['yaml', 'yml']:
|
| 299 |
+
yaml_data = yaml.safe_load(file_content)
|
| 300 |
+
mdf_model = Model.from_dict(yaml_data)
|
| 301 |
+
elif file_extension == 'bson':
|
| 302 |
+
bson_data = bson.decode(file_content)
|
| 303 |
+
mdf_model = Model.from_dict(bson_data)
|
| 304 |
else:
|
| 305 |
st.error("Unsupported file format. Please use JSON or YAML files.")
|
| 306 |
return None
|