generated from streamlit/basic-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2c82ea2
Showing
6 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "Streamlit Template from dev container", | ||
"image": "ghcr.io/streamlit/basic-template:latest", | ||
"customizations": { | ||
"codespaces": { | ||
"openFiles": [ | ||
"README.md", | ||
"streamlit_app.py" | ||
] | ||
} | ||
}, | ||
"postAttachCommand": { | ||
"server": "streamlit run streamlit_app.py --server.enableCORS false --server.enableXsrfProtection false" | ||
}, | ||
"portsAttributes": { | ||
"8501": { | ||
"label": "Application", | ||
"onAutoForward": "openPreview" | ||
} | ||
}, | ||
"forwardPorts": [ | ||
8501 | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "Streamlit Template image build and push", | ||
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye", | ||
"customizations": { | ||
"vscode": { | ||
"settings": {}, | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-python.vscode-pylance" | ||
] | ||
} | ||
}, | ||
"updateContentCommand": "[ -f packages.txt ] && sudo apt update && sudo apt upgrade -y && sudo xargs apt install -y <packages.txt; [ -f requirements.txt ] && pip3 install --user -r requirements.txt; pip3 install --user streamlit; echo '✅ Packages installed and Requirements met'" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Dev Container Build and Push Image | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- "main" | ||
tags: | ||
- "v*.*.*" | ||
pull_requests: | ||
branches: | ||
- "main" | ||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
id: checkout | ||
uses: actions/checkout@v1 | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.REGISTRY_TOKEN }} | ||
- | ||
name: Pre-build dev container image | ||
uses: devcontainers/ci@v0.2 | ||
with: | ||
subFolder: .github | ||
imageName: ghcr.io/${{ github.repository }} | ||
cacheFrom: ghcr.io/${{ github.repository }} | ||
push: always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
altair | ||
pandas | ||
streamlit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import altair as alt | ||
import numpy as np | ||
import pandas as pd | ||
import streamlit as st | ||
|
||
""" | ||
# Welcome to Streamlit! | ||
Edit `/streamlit_app.py` to customize this app to your heart's desire :heart:. | ||
If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community | ||
forums](https://discuss.streamlit.io). | ||
In the meantime, below is an example of what you can do with just a few lines of code: | ||
""" | ||
|
||
num_points = st.slider("Number of points in spiral", 1, 10000, 1100) | ||
num_turns = st.slider("Number of turns in spiral", 1, 300, 31) | ||
|
||
indices = np.linspace(0, 1, num_points) | ||
theta = 2 * np.pi * num_turns * indices | ||
radius = indices | ||
|
||
x = radius * np.cos(theta) | ||
y = radius * np.sin(theta) | ||
|
||
df = pd.DataFrame({ | ||
"x": x, | ||
"y": y, | ||
"idx": indices, | ||
"rand": np.random.randn(num_points), | ||
}) | ||
|
||
st.altair_chart(alt.Chart(df, height=700, width=700) | ||
.mark_point(filled=True) | ||
.encode( | ||
x=alt.X("x", axis=None), | ||
y=alt.Y("y", axis=None), | ||
color=alt.Color("idx", legend=None, scale=alt.Scale()), | ||
size=alt.Size("rand", legend=None, scale=alt.Scale(range=[1, 150])), | ||
)) |