I’m trying to load a neural network model in my streamlit app, but it appears the error:
Traceback (most recent call last):
File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
exec(code, module.__dict__)
File "/app/dry_forest_fire/interface.py", line 20, in <module>
rede_neural = joblib.load('Models/rede_neural')
File "/home/appuser/venv/lib/python3.9/site-packages/joblib/numpy_pickle.py", line 587, in load
obj = _unpickle(fobj, filename, mmap_mode)
File "/home/appuser/venv/lib/python3.9/site-packages/joblib/numpy_pickle.py", line 506, in _unpickle
obj = unpickler.load()
File "/usr/local/lib/python3.9/pickle.py", line 1212, in load
dispatch[key[0]](self)
File "/usr/local/lib/python3.9/pickle.py", line 1589, in load_reduce
stack[-1] = func(*args)
File "/home/appuser/venv/lib/python3.9/site-packages/keras/saving/pickle_utils.py", line 40, in deserialize_model_from_bytecode
with tarfile.open(fileobj=b, mode="r") as archive:
File "/usr/local/lib/python3.9/tarfile.py", line 1625, in open
raise ReadError("file could not be opened successfully")
tarfile.ReadError: file could not be opened successfully
The other model which I just used random forest loads ok (I also verified the path). I’m trying to load the neural network like this:
import base64
import streamlit as st
import plotly.express as px
import pandas as pd
import numpy as np
import joblib
from sklearn.preprocessing import StandardScaler
neural_network= joblib.load('Models/rede_neural') #Not ok
floresta_aleatoria = joblib.load('Models/floresta_aleatoria') #Load ok
------- Requirements.txt -------
joblib==1.1.1
numpy==1.19.4
pandas==1.4.4
plotly==5.13.1
scikit_learn==1.2.1
streamlit==1.19.0
typing-extensions==3.10.0.0
tensorflow>=2.6.3
tensorflow-cpu>=2.6.3
Can anyone help me about this? Ps.: the local script is running normal