Skip to content

Commit c3314a6

Browse files
authored
Prerelease 1.56.0 - Embedded app sources (#1441)
* Bump to nightly * Menu button * Table apps * Update table key-value example * Dataframe selections example * Audio column example * Video column example * Bemp embedded apps to latest
1 parent 997b19a commit c3314a6

File tree

33 files changed

+147
-27
lines changed

33 files changed

+147
-27
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
streamlit>=1.55.0
1+
streamlit>=1.56.0
22
webvtt-py
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import base64
2+
import pandas as pd
3+
import streamlit as st
4+
5+
6+
@st.cache_data
7+
def load_audio_as_base64():
8+
with open("python/api-examples-source/cat-purr.mp3", "rb") as audio_file:
9+
audio_bytes = audio_file.read()
10+
return base64.b64encode(audio_bytes).decode("utf-8")
11+
12+
13+
data_df = pd.DataFrame(
14+
{
15+
"source": [
16+
"Small and fluffy house panther",
17+
"Wikimedia, Performed by Muriel Nguyen Xuan and Stéphane Magnenat",
18+
],
19+
"audio": [
20+
f"data:audio/mp3;base64,{load_audio_as_base64()}",
21+
"https://upload.wikimedia.org/wikipedia/commons/c/c4/Muriel-Nguyen-Xuan-Chopin-valse-opus64-1.ogg",
22+
],
23+
}
24+
)
25+
26+
st.dataframe(
27+
data_df,
28+
column_config={
29+
"audio": st.column_config.AudioColumn("Preview Audio"),
30+
},
31+
)
32+
33+
st.caption(
34+
"""
35+
##### Audio credit:
36+
37+
Performer: _Muriel Nguyen Xuan_ and _Stéphane Magnenat_
38+
39+
Composer: Frédéric Chopin
40+
41+
License: Creative Commons Attribution-Share Alike 4.0 International, 3.0 Unported, 2.5 Generic, 2.0 Generic and 1.0 Generic license.
42+
https://creativecommons.org/licenses/by-sa/4.0/
43+
44+
URL:
45+
https://upload.wikimedia.org/wikipedia/commons/c/c4/Muriel-Nguyen-Xuan-Chopin-valse-opus64-1.ogg
46+
47+
"""
48+
)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import pandas as pd
2+
import streamlit as st
3+
from numpy.random import default_rng as rng
4+
5+
df = pd.DataFrame(
6+
rng(0).standard_normal((12, 5)), columns=["a", "b", "c", "d", "e"]
7+
)
8+
9+
if st.button("Select the first row"):
10+
st.session_state.data = {"selection": {"rows": [0]}}
11+
if st.button("Select column a"):
12+
st.session_state.data = {"selection": {"columns": ["a"]}}
13+
if st.button("Select the first cell of column a"):
14+
st.session_state.data = {"selection": {"cells": [[0, "a"]]}}
15+
16+
event = st.dataframe(
17+
df,
18+
key="data",
19+
on_select="rerun",
20+
selection_mode=["single-cell", "single-row", "single-column"],
21+
)
22+
23+
event.selection
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import streamlit as st
2+
3+
st.table(
4+
{
5+
":material/folder: Project": "**Streamlit** - The fastest way to build data apps",
6+
":material/code: Repository": "[github.com/streamlit/streamlit](https://github.com/streamlit/streamlit)",
7+
":material/new_releases: Version": ":gray-badge[1.45.0]",
8+
":material/license: License": ":green-badge[Apache 2.0]",
9+
":material/group: Maintainers": ":blue-badge[Core Team] :violet-badge[Community]",
10+
},
11+
border="horizontal",
12+
width="content",
13+
)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import pandas as pd
2+
import streamlit as st
3+
4+
df = pd.DataFrame({"Name": ["Alice", "Bob"], "Age": [25, 30]})
5+
st.table(df, hide_index=True, hide_header=True)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import pandas as pd
2+
import streamlit as st
3+
4+
data_df = pd.DataFrame(
5+
{
6+
"description": [
7+
"Get started with Streamlit",
8+
"Get started with Community Cloud",
9+
],
10+
"video": [
11+
"https://s3-us-west-2.amazonaws.com/assets.streamlit.io/videos/hero-video.mp4",
12+
"https://s3-us-west-2.amazonaws.com/assets.streamlit.io/videos/streamlit_sharing_silent.mp4",
13+
],
14+
}
15+
)
16+
17+
st.dataframe(
18+
data_df,
19+
column_config={
20+
"video": st.column_config.VideoColumn("Preview Video"),
21+
},
22+
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
streamlit>=1.55.0
1+
streamlit>=1.56.0

python/api-examples-source/hello/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ pandas==1.5.3
22
numpy==1.23.5
33
altair==4.2.0
44
pydeck==0.8.0
5-
streamlit>=1.55.0
5+
streamlit>=1.56.0

python/api-examples-source/mpa-hello/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ numpy==1.23.5
33
altair==4.2.0
44
pydeck==0.8.0
55
opencv-python-headless==4.8.1.78
6-
streamlit>=1.55.0
6+
streamlit>=1.56.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
streamlit>=1.55.0
1+
streamlit>=1.56.0

0 commit comments

Comments
 (0)