最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Streamlit application deployment issue - Stack Overflow

programmeradmin7浏览0评论

For training I am trying to deploy an application I developped under Streamlit on a local host. I built a docker image and when I run the image and click on the link, streamlit opens and I have the error message:

AttributeError: 'NoneType' object has no attribute 'read'
Traceback:

File "/app/env_streamlit/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 121, in exec_func_with_error_handling
result = func()
File "/app/env_streamlit/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 640, in code_to_exec
exec(code, module.__dict__)
File "/app/streamlit_demo.py", line 17, in <module>
open_file = fitz.open(stream=uploaded_file.read(), filetype='pdf')

Here is my docker file:

FROM python:3.9-slim

WORKDIR /app

COPY . /app

# Installer virtualenv
RUN pip install virtualenv

# Création de l'environnement virtuel
RUN virtualenv env_streamlit

# Activation de l'environnement et installation des dépendances
RUN /bin/bash -c "source env_streamlit/bin/activate && pip install -r requirements.txt"

RUN pip3 install -r requirements.txt

# Exposer le port sur lequel l'application va s'executer
EXPOSE 8501 
# 8501 est le port par défaut de streamlit

# Vérification si le port fonctionne
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health


ENTRYPOINT ["env_streamlit/bin/streamlit", "run", "streamlit_demo.py", "--server.port=8501", "--server.address=0.0.0.0"]

Here is my requirements file:

streamlit
PyMuPDF
pdfminer-six

Thanks for your help !

发布评论

评论列表(0)

  1. 暂无评论