Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
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
File "/home/dataiku/workspace/code_studio-versioned/streamlit/app.py", line 122, in <module>
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
The get_predictor does not currently work in a container and streamlit webapp runs only in containerized execution.
For now, you won't be able to use get_predictor in the streamlet webapp as this now requires direct access to the DSS filesystem.
We are working on allowing get_predictor to in a containerized environment in a future release.
Added ability to use a Visual model’s predictor Python API from code running in containerized execution