Running a Streamlit App

On this page you will learn how to run a Streamlit App on BDS.

Streamlit turns data scripts into shareable web apps in minutes. All in pure Python code. No front‑end experience required. For more information see the Streamlit documentation.

Getting started

For this example we will be running the popular "Hello world" on a Streamlit App, to do this, we need to execute the following steps:

On the project summary of the recently created project, click on the "OPEN IDE" button to open the Online Code Editor.

  • Use the "New Folder" option in the Online Code Editor to create a new folder in the workspace. Name it "streamlit_app" and press Enter.

  • After the folder is created, we need to create our python file that will contain all the code for our Streamlit App. So, click on the recently created folder and use the "New File" option to create a new file within it. Name it "hello_world.py" and press Enter.

  • Now our python file will be created and we will be able to write code on it. Click on the "hello_world.py" file to open it in the Editor, and type the following code:

# Hello world example
import streamlit as st

st.write("""
# My First App
Hello world
""")
  • Rigth-click on the "hello_world.py" file to show the Contextual Menu, and click on the "BlackDiamond: Run Streamlit" option.

A new Terminal will be opened and the Streamlit run command will be executed, creating and sharing the Streamlit App.

After the Streamlit App is ready, a notification will be shown indicating the port used. Click on the "Open in browser" button to open the Streamlit App.

Congrats! Now our Streamlit App is ready.

Use the Streamlit App header to identify your project and the executed application.

Considerations

  • To close or cancel the execution of the Streamlit App, go to the Terminal in the Online Code Editor and press Ctrl + C.

  • If the Online Code Editor is inactive, the Streamlit App will be suspended as well, and the following screen will be shown:

  • To restart the Streamlit App, click on the "OPEN IDE" button from the inactivity screen and use the BlackDiamond: Run Streamlit option from the Contextual Menu again in the corresponding python file.

Last updated