I have already trained a model and the weights are loaded in a .h5 file. I have uploaded the file to GitHub repository using LFS. Now when I try to use that model in my app using
url = 'https://github.com/jithincheriyan/Web_App/blob/master/Transformer_BERT_Model.h5'
filename = url.split('/')[-1]
trained_model.load_weights(urllib.request.urlretrieve(url, filename))
The following error appears:
Traceback (most recent call last):
File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/script_runner.py", line 350, in _run_scriptexec(code, module.__dict__)
File "/app/web_app/Streamlit_App.py", line 43, in <module>st.text(L1_test([comment]))
File "/app/web_app/Streamlit_App.py", line 19, in L1_test trained_model.load_weights(urllib.request.urlretrieve(url, filename))
File "/home/appuser/venv/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 2172, in load_weights
if _is_hdf5_filepath(filepath):
File "/home/appuser/venv/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 2785, in _is_hdf5_filepath
return (filepath.endswith('.h5') or filepath.endswith('.keras') or
AttributeError: 'tuple' object has no attribute 'endswith'