Skip to content

Commit

Permalink
Improve 000_intro/streamlit_app.py (#1202)
Browse files Browse the repository at this point in the history
* Improve 000_intro/streamlit_app.py

* Fix
  • Loading branch information
whitphx authored Dec 17, 2024
1 parent 404a70b commit 9605754
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions packages/sharing-editor/public/samples/000_intro/streamlit_app.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import streamlit as st
from PIL import Image

st.title("Stlite Sharing: Serverless Streamlit app platform")

image = Image.open('data/logo.png')
st.image(image, caption='Stlite logo')
col1, col2 = st.columns(2, vertical_alignment="center", gap="large")
with col1:
st.image("data/logo.png", use_container_width=True)
with col2:
st.image("https://streamlit.io/images/brand/streamlit-mark-color.svg", use_container_width=True)

st.markdown("""
### Stlite
**Stlite** is a port of _Streamlit_ to Wasm, powered by Pyodide,
**Stlite** is a port of _Streamlit:streamlit:_ to Wasm, powered by Pyodide,
that runs completely on web browsers.
The official repository is [🔗 here](https://github.com/whitphx/stlite).
Expand Down Expand Up @@ -55,10 +57,17 @@
import numpy as np
import pandas as pd


@st.cache_data
def get_chart_data():
return pd.DataFrame(
np.random.randn(20, 3),
columns=['a', 'b', 'c']
)


st.subheader("Chart sample")
chart_data = pd.DataFrame(
np.random.randn(20, 3),
columns=['a', 'b', 'c'])
chart_data = get_chart_data()

tab1, tab2, tab3 = st.tabs(["Line chart", "Area chart", "Bar chart"])
with tab1:
Expand All @@ -69,10 +78,17 @@
st.bar_chart(chart_data)

st.subheader("DataFrame sample")
df = pd.DataFrame(
np.random.randn(50, 20),
columns=('col %d' % i for i in range(20)))


@st.cache_data
def get_sample_df():
return pd.DataFrame(
np.random.randn(50, 20),
columns=('col %d' % i for i in range(20))
)


df = get_sample_df()
st.dataframe(df)

st.subheader("Camera input")
Expand Down

0 comments on commit 9605754

Please sign in to comment.