Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
streamlit>=1.55.0
streamlit>=1.56.0
webvtt-py
48 changes: 48 additions & 0 deletions python/api-examples-source/data.audio_column.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import base64
import pandas as pd
import streamlit as st


@st.cache_data
def load_audio_as_base64():
with open("python/api-examples-source/cat-purr.mp3", "rb") as audio_file:
audio_bytes = audio_file.read()
return base64.b64encode(audio_bytes).decode("utf-8")


data_df = pd.DataFrame(
{
"source": [
"Small and fluffy house panther",
"Wikimedia, Performed by Muriel Nguyen Xuan and Stéphane Magnenat",
],
"audio": [
f"data:audio/mp3;base64,{load_audio_as_base64()}",
"https://upload.wikimedia.org/wikipedia/commons/c/c4/Muriel-Nguyen-Xuan-Chopin-valse-opus64-1.ogg",
],
}
)

st.dataframe(
data_df,
column_config={
"audio": st.column_config.AudioColumn("Preview Audio"),
},
)

st.caption(
"""
##### Audio credit:

Performer: _Muriel Nguyen Xuan_ and _Stéphane Magnenat_

Composer: Frédéric Chopin

License: Creative Commons Attribution-Share Alike 4.0 International, 3.0 Unported, 2.5 Generic, 2.0 Generic and 1.0 Generic license.
https://creativecommons.org/licenses/by-sa/4.0/

URL:
https://upload.wikimedia.org/wikipedia/commons/c/c4/Muriel-Nguyen-Xuan-Chopin-valse-opus64-1.ogg

"""
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import pandas as pd
import streamlit as st
from numpy.random import default_rng as rng

df = pd.DataFrame(
rng(0).standard_normal((12, 5)), columns=["a", "b", "c", "d", "e"]
)

if st.button("Select the first row"):
st.session_state.data = {"selection": {"rows": [0]}}
if st.button("Select column a"):
st.session_state.data = {"selection": {"columns": ["a"]}}
if st.button("Select the first cell of column a"):
st.session_state.data = {"selection": {"cells": [[0, "a"]]}}

event = st.dataframe(
df,
key="data",
on_select="rerun",
selection_mode=["single-cell", "single-row", "single-column"],
)

event.selection
13 changes: 13 additions & 0 deletions python/api-examples-source/data.table_auto_header.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import streamlit as st

st.table(
{
":material/folder: Project": "**Streamlit** - The fastest way to build data apps",
":material/code: Repository": "[github.com/streamlit/streamlit](https://github.com/streamlit/streamlit)",
":material/new_releases: Version": ":gray-badge[1.45.0]",
":material/license: License": ":green-badge[Apache 2.0]",
":material/group: Maintainers": ":blue-badge[Core Team] :violet-badge[Community]",
},
border="horizontal",
width="content",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import pandas as pd
import streamlit as st

df = pd.DataFrame({"Name": ["Alice", "Bob"], "Age": [25, 30]})
st.table(df, hide_index=True, hide_header=True)
22 changes: 22 additions & 0 deletions python/api-examples-source/data.video_column.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import pandas as pd
import streamlit as st

data_df = pd.DataFrame(
{
"description": [
"Get started with Streamlit",
"Get started with Community Cloud",
],
"video": [
"https://s3-us-west-2.amazonaws.com/assets.streamlit.io/videos/hero-video.mp4",
"https://s3-us-west-2.amazonaws.com/assets.streamlit.io/videos/streamlit_sharing_silent.mp4",
],
}
)

st.dataframe(
data_df,
column_config={
"video": st.column_config.VideoColumn("Preview Video"),
},
)
2 changes: 1 addition & 1 deletion python/api-examples-source/guides/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
2 changes: 1 addition & 1 deletion python/api-examples-source/hello/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ pandas==1.5.3
numpy==1.23.5
altair==4.2.0
pydeck==0.8.0
streamlit>=1.55.0
streamlit>=1.56.0
2 changes: 1 addition & 1 deletion python/api-examples-source/mpa-hello/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ numpy==1.23.5
altair==4.2.0
pydeck==0.8.0
opencv-python-headless==4.8.1.78
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
2 changes: 1 addition & 1 deletion python/api-examples-source/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ pydeck
Faker
openai
vega_datasets
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
streamlit>=1.55.0
streamlit>=1.56.0
toml
sqlalchemy==1.4
duckdb
Expand Down
2 changes: 1 addition & 1 deletion python/api-examples-source/theming/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
streamlit>=1.55.0
streamlit>=1.56.0
vega_datasets
altair==4.2.0
plotly==5.13.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
vega_datasets
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Faker
streamlit>=1.55.0
streamlit>=1.56.0
2 changes: 1 addition & 1 deletion python/api-examples-source/tutorials/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
9 changes: 9 additions & 0 deletions python/api-examples-source/widget.menu_button.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import streamlit as st

action = st.menu_button("Export", options=["CSV", "JSON", "PDF"])
if action == "CSV":
st.write("Exporting as CSV...")
elif action == "JSON":
st.write("Exporting as JSON...")
elif action == "PDF":
st.write("Exporting as PDF...")
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
2 changes: 1 addition & 1 deletion python/concept-source/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.55.0
streamlit>=1.56.0
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
streamlit>=1.55.0
streamlit>=1.56.0
langchain-openai