Skip to content

Instantly share code, notes, and snippets.

@wesslen
Last active March 30, 2025 06:13
Show Gist options
  • Select an option

  • Save wesslen/7d35f6e1b8dd8ac2a5472c461bed56e3 to your computer and use it in GitHub Desktop.

Select an option

Save wesslen/7d35f6e1b8dd8ac2a5472c461bed56e3 to your computer and use it in GitHub Desktop.
streamlit-spacy-docker-container
import streamlit as st
import spacy_streamlit
import spacy
# see https://github.com/explosion/spacy-streamlit
st.title("Spacy Streamlit App")
spacy_model = ["en_core_web_sm"]
visualizers = ["parser", "ner", "tokens"] # exclude "textcat", "similarity"
spacy_streamlit.visualize(spacy_model, "Rusty is the best dog in Charlotte, NC.", visualizers)
FROM python:3.7
EXPOSE 8501
WORKDIR /app
COPY requirements.txt ./requirements.txt
RUN pip3 install -r requirements.txt
COPY . .
CMD streamlit run app.py
streamlit
spacy==2.3.1
spacy_streamlit
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz
@wesslen
Copy link
Copy Markdown
Author

wesslen commented Feb 4, 2021

Run on Docker machine or play-with-docker.com:

git clone https://gist.github.com/wesslen/7d35f6e1b8dd8ac2a5472c461bed56e3 streamlit-docker
cd streamlit-docker
docker build -t streamlit-docker .
docker run -dp 8501:8501 streamlit-docker

Open browser to 8501 port. Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment