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.
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:
- Create a new "code from scratch" project on BDS, for more information about project creation see Creating my first project.
Code from scratch project
On the project summary of the recently created project, click on the "OPEN IDE" button to open the Online Code Editor.
OPEN IDE Button on project summary
- 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.
New Folder option
- 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.
New File option
- 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
# My First App
Hello world example code
- Rigth-click on the "hello_world.py" file to show the Contextual Menu, and click on the "BlackDiamond: Run Streamlit" option.
Run Streamlit option in Contextual Menu
A new Terminal will be opened and the Streamlit run command will be executed, creating and sharing the Streamlit App.
New terminal for Run Streamlit command
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.
Streamlit App execution notification
Congrats! Now our Streamlit App is ready.
Streamlit App execution
Use the Streamlit App header to identify your project and the executed application.
Streamlit App header
- To close or cancel the execution of the Streamlit App, go to the Terminal in the Online Code Editor and press Ctrl + C.
Streamlit App execution canceled
- If the Online Code Editor is inactive, the Streamlit App will be suspended as well, and the following screen will be shown:
Inactivity screen for Streamlit App
- 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 modified 2mo ago