i am trying to deploy app which contain some module like fitz , pandas and so on. There is a package named fitz
on PyPI. Because PyMuPDF uses the same name, fitz
, as its top-level text, both packages cannot co-exist in the same Python - except with the aforementioned change. So it gives me error like this ModuleNotFoundError: No module named ‘frontend’.
Hi @Kayshika_Code, welcome to the Streamlit community!!
There are series of changes you need to make to successfully deploy your app:
- Remove
fitz==0.0.1.dev2
from line 1 of requirements.txt. It is an outdated package that has been replaced by PyMuPDF. - From reading the med7 docs, you’ll see that you need to include a line in
requirements.txt
containinghttps://huggingface.co/kormilitzin/en_core_med7_lg/resolve/main/en_core_med7_lg-any-py3-none-any.whl
- Update line 4 to read:
spacy==3.1.4
. The med7 model from Step 2 depends onspacy < 3.2.0 and >=3.1.4
. - Replace the image paths in App.py with just the image names. eg:
Image.open('image-1.png')
. Recall that Streamlit Cloud is unaware of the directory structure of your local machine. - As the model from Step 2 is large (700+ MB), you should cache the model with
st.experimental_singleton
to reuse the same model across users and app reruns, and prevent exhausting your app resources. Define the following function outside ofmain()
:
@st.experimental_singleton
def load_model():
nlp = spacy.load("en_core_med7_lg")
return nlp
- In your
main()
method, replacenlp = spacy.load("en_core_med7_lg")
withnlp = load_model()
For reference, a fork with the above changes is here: GitHub - snehankekre/Drug-Entity-Extractor
Once you make the above changes, your app should successfully deploy!
Happy Streamlit-ing!
Snehan
After completed, in right side terminal i didn’t see any url that i can share to people.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.