Skip to content

pixiebrix/streamlit-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PixieBrix Streamlit Demo

This repository contains an example Streamlit application that you can embed on any page using PixieBrix.

Parsing Query Parameters in Streamlit

In your Streamlit app, parse the query parameters with experimental_get_query_params

# https://github.com/streamlit/release-demos/blob/master/0.65/demos/query_params.py
query_params = st.experimental_get_query_params()
default = query_params["text"][0] if "text" in query_params else ""

Passing Query Parameters

In PixieBrix, add a panel with an @pixiebrix/iframe brick. For the URL, specify the URL for the Streamlit app with the query parameter:

https://share.streamlit.io/pixiebrix/streamlit-demo/main/demo.py?text={{ description | urlencode | safe }}

For text parameters, you can use the Nunjucks template engine to encode the parameter (in YAML, specify the templateEngine: nunjucks directive)