Streamlit webapp .get_predictor()

Matteo
Matteo Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 3 ✭✭✭

Hi everyone,

I am attempting to convert a Dash webapp to Streamlit. The app simply takes inputs parameters from the users and generates predictions based on a model trained in the same flow where the app is stored.

Although everything works smoothly in both Dash and Streamlit, I am encountering issues when attempting to call the machine learning models in Streamlit.

Below is the code snippet that is returning an error in Streamlit:

model = dataiku.Model("3cxcmJox")
model_pred = model.get_predictor()

FileNotFoundError: [Errno 2] No such file or directory: '/home/dataiku/data/saved_models/FLOW/3cxcmJox/versions/1664296109477/core_params.json'

File "/opt/dataiku/python-code-envs/pyenv-streamlit/lib/python3.7/site-packages/streamlit/scriptrunner/script_runner.py", line 475, in _run_script
exec(code, module.__dict__)

File "/home/dataiku/workspace/code_studio-versioned/streamlit/app.py", line 122, in <module>
model.get_predictor()

File "/opt/dataiku/python/dataiku/core/saved_model.py", line 278, in get_predictor
self._predictors[version_id] = build_predictor_for_saved_model(model_folder, sm.get("conditionalOutputs", []))

File "/opt/dataiku/python/dataiku/core/saved_model.py", line 402, in build_predictor_for_saved_model
core_params = dkujson.load_from_filepath(osp.join(model_folder, "core_params.json"))

File "/opt/dataiku/python/dataiku/core/dkujson.py", line 37, in load_from_filepath
with open(filepath) as fp:

Does anyone have a solution to this issue?

Thanks in advance

Tagged:

Answers

Setup Info
    Tags
      Help me…