Skip to content

Commit

Permalink
added streamlit from another branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Polyakov committed Dec 6, 2023
1 parent 9587cda commit dbf7798
Show file tree
Hide file tree
Showing 9 changed files with 1,885 additions and 8 deletions.
23 changes: 23 additions & 0 deletions Dockerfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# app/Dockerfile

FROM python:3.9-slim

# Copy Code
WORKDIR /wise_pizza

RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
git \
&& rm -rf /var/lib/apt/lists/*

COPY . .

RUN pip3 install -r docker_requirements.txt

EXPOSE 8501

HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

ENTRYPOINT ["streamlit", "run", "streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Sometimes, rather than explaining the change in totals from one period to the ne
- [Comparison between two datasets](#understanding-differences-in-two-time-periods-or-two-dataframes)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Streamlit app](#streamlit-app)
- [Docker container](#docker-container)
- [For Developers](#for-developers)
- [Tests](#testing)

Expand Down Expand Up @@ -146,6 +148,31 @@ sf.relevant_cluster_names

Please see the full example [here](https://github.com/transferwise/wise-pizza/blob/main/notebooks/Finding%20interesting%20segments.ipynb)

## Streamlit app
In the root directory of this repository, there is a Streamlit app. This is an interface that allows you to upload your own files and run analyses, as you saw in the Jupyter Notebook provided as an example.

To run this, you need to:
1. Create a virtual environment (e.g. using pyenv)
2. Activate the virtual environment
3. Run `pip -r requirements.txt` before running, to install necessary dependencies
4. Run `streamlit run streamlit_app.py` to run Streamlit

### Docker container

We created a Docker container that makes it easier to deploy this solution elsewhere

You need to first: Create the Docker image
Create the Docker image

```Python
docker build -t streamlit .
```
And then simply run the image

```Python
docker run -p 8501:8501 streamlit
```

## For Developers


Expand Down
63 changes: 63 additions & 0 deletions Untitled.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"id": "25435673",
"metadata": {},
"outputs": [],
"source": [
"import streamlit as st\n",
"col1, col2 = st.columns(2)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "f0a397a1",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n"
]
}
],
"source": [
"with col1:\n",
" print(1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f106bb9b",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
12 changes: 12 additions & 0 deletions docker_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ipython==8.14.0
kaleido==0.2.1
numpy==1.24.0
pandas==2.0.2
pytest==7.4.3
plotly==5.15.0
scikit_learn==1.3.2
scipy==1.8.0
tqdm==4.66.1
cloudpickle==3.0.0
pivottablejs==0.9.0
streamlit==1.28.0
Loading

0 comments on commit dbf7798

Please sign in to comment.