Login
Back to bricks list
Introduction Version

Streamlit live task

TASK
Typing name :  TASK.gws_core.StreamlitLiveTask Brick :  gws_core

Live task to generate a streamlit app dashboard

Live task to generate a streamlit app dashboard.

Warning: It is recommended to use code snippets comming from trusted sources.

Here is the general documentation for live task (including how to use the parameters): https://constellab.community/bricks/gws_core/latest/doc/developer-guide/live-task/getting-started/69820653-52e0-41ba-a5f3-4d9d54561779

Here is the documentation of the live task: https://constellab.community/bricks/gws_core/latest/doc/developer-guide/live-task/env-live-task/c6acb3c3-2a7c-44cd-8fb2-ea1beccdbdcc

More information about streamlit: https://streamlit.io

Input

Resource
Optional

Output

Streamlit app
Streamlit App

Configuration

code

Optional

Code of the streamlit app to run

Type : python_code_paramDefault value : # This is a template for a streamlit live task. # This generates an app with one dataframe as input. Then the user can select 2 columns to plot a scatter plot. import plotly.express as px import streamlit as st from pandas import DataFrame # Your Streamlit app code here st.title("Dashboard example") # show a table from file_path which is a csv file full width if sources: df: DataFrame = sources[0].get_data() # show the dataframe st.dataframe(df) # add a select widget with the columns names with no default value # set the selectbox side by side col1, col2 = st.columns(2) with col1: x_col = st.selectbox("Select x column", options=df.columns, index=0) with col2: y_col = st.selectbox("Select y column", options=df.columns, index=1) if x_col and y_col: # Generate a scatter plot with plotly express fig = px.scatter(df, x=x_col, y=y_col) st.plotly_chart(fig)