Creating Multipage Applications Using Streamlit
Last Updated :
26 Apr, 2025
In this article, we will see how to make a Multipage WebApp using Python and Streamlit.
What is Streamlit?
Streamlit is an Open Source framework especially used for tasks related to Machine Learning and Data Science. It can create web apps with a very less amount of code. It is widely used because it supports most Data Science libraries like Pandas, Numpy, Matplotlib, SymPy, PyTorch, etc. Callbacks are not required with Streamlit since widgets are regarded as variables. Computation pipelines are made easier and faster by data caching. The application is automatically deployed in the shared link when Streamlit detects updates to the associated Git repository.
Note: Streamlit only supports Python version >= 3.6.
In this tutorial, we will look into the process of how we can make a Multipage Streamlit web app and will also look that how it is possible order those pages, add simple texts, etc.
Only Streamlit module is required. Use the following command to install it.
pip install streamlit
Importing the Module
Python3
Here we are importing the only required module for our tutorial, Streamlit, and giving it an alias stm, user can use any alias they want in place of stm.
Initializing the Coding Process
Firstly we will create a simple Homepage i.e the main page that would be shown when the WebApp is executed.
Python3
import streamlit as stm
stm.set_page_config(page_title = "This is a Multipage WebApp")
stm.title("This is the Home Page Geeks.")
Explanation:
- Firstly we are importing the module with an alias stm.
- Then use the set_page_config() method of Streamlit to provide a page_title of that page as This is a Multipage WebApp, now this will only be associated with the page we have declared.
- Then give a title to the Page This is the Home Page Geeks..
Output :
Now as we are building a MultiPage app we need a sidebar from which we can access all of them, streamlit has a method sidebar which can be used here.
Python3
import streamlit as stm
stm.set_page_config(page_title = "This is a Multipage WebApp")
stm.title("This is the Home Page Geeks.")
stm.sidebar.success("Select Any Page from here")
This snippet is the same as the previous one, but we are just adding a new method sidebar with success method, the sidebar method will create a sidebar and the success method is used to display a success message after successfully creating the sidebar. here the message is Select Any Page from here and that will have a background color of Green to denote it has been successfully created.
Output:
Making it Multipage
Now as we are done with the main page, it is time to build some more pages and make it Multipage. To make it multipage follow the below steps:
In the directory where the python file is situated, create a new folder named pages. Users have to name that folder pages as Streamlit will not understand any other directory name.
After creating and saving just reload the page from your browser and you will see these two pages in the sidebar we created earlier.
Adding content on both of the pages
To add content in both pages we simply write code on those Python files by importing streamlit and using it's methods.
Python3
# PageOne contents
import streamlit as stm
stm.title("This is PageOne Geeks.")
here we are adding a Title to the page which will be displayed like the below Image. This title can be only visible on the page where we have written the code, not in other pages.
Output:
If we notice carefully at the output we will see that there are some changes visible in the page.
- The tab contains pageone. Streamlit, not This is a Multipage WebApp as it was visible in the homepage, that's because we haven't given any title to this page till now and that title was only associated with the homepage not everypage.
- Next, the sidebar text Select any Pages from here has also vanished, it is also only associated with the Homepage i.e the respective page in which we are writing the code and not with pageone. But we can create that by writing the code in pageone too.
Python3
# Code in pageone.py file
import streamlit as stm
stm.title("This is PageOne Geeks.")
stm.sidebar.success("You are currently viewing Page One Geek")
Like the Homepage here we are also adding sidebar.success() method to add some success text to show some information.
Output:
Python3
# Code in pagetwo.py
import streamlit as stm
stm.title("This is PageTwo Geeks.")
stm.sidebar.success("You are currently viewing Page Two Geek")
Output:
Same as pageone.py.
Changing the order of the Pages
Streamlit by default order our pages alphabetically, we can change that by making changes in the file name by adding a specific number infront of their name followed by an underscore like this -
Now pagetwo.py will act as the first page and pageone.py will act as the second page, their order will also be changed in Streamlit app.
The number we added will not be shown here but the order will be followed.
Similar Reads
Create And Deploy A Stock Price Web Application using Python and Streamlit
In this article, we are going to see how to create and deploy a stock price web application. To create an amazing Web Application that deals with Data Science, we have a perfect platform to carry out this task. Streamlit and Python package builds and shares the data application in the fastest way po
4 min read
Adding Lottie animation in Streamlit WebApp
In this article, we will see how we can embed Lottie Animation in our Streamlit WebApp using Python. What is Lottie Animation? An animation file format called a Lottie, which is based on JSON, makes it simple to ship animations across all platforms. They are compact files that may be scaled up or do
5 min read
Realtime chat app using Django
Chat Room has been the most basic step toward creating real-time and live projects. The chat page that we will create will be a simple HTML boilerplate with a simple h1 text with the name of the current user and a link to log out to the user who is just logged in. You may need to comment on the line
11 min read
Create Interactive Dashboard in Python using Streamlit
An interactive and Informative dashboard is very necessary for better understanding our data sets. This will help a researcher for getting a better understanding of our results and after that, a researcher can make some necessary changes for better understanding. Visual Reports is must better than i
6 min read
Tkinter Application to Switch Between Different Page Frames
Prerequisites: Python GUI â tkinter Sometimes it happens that we need to create an application with several pops up dialog boxes, i.e Page Frames. Here is a step by step process to create multiple Tkinter Page Frames and link them! This can be used as a boilerplate for more complex python GUI applic
6 min read
Create An Interactive Web App Using Shiny Package In R
Perhaps a quick introduction to what Shiny is would be helpful before moving on. Creating interactive web applications with R Programming Language is simple thanks to the Shiny package. Shiny's advantage is that it enables you to extend your R code to the web, which essentially increases the usabili
4 min read
Typing Speed Test Project Using Python Streamlit Library
Typing Speed Test Project involves typing content with the input field displayed on the screen where we need to type the same content also a timer of 30 seconds runs continuously, and when it reaches zero, our typing speed is displayed on the screen in words per minute (WPM). This article will guide
2 min read
3D Modeling & Animation App Using Python
In recent times, Python has become widely recognized as a potent language for a variety of uses beyond the traditional realm of software development. One such domain is 3D modeling and animation, where Python's flexibility and user-friendly nature can be exploited to develop strong applications. Thi
9 min read
Status elements in Streamlit
In this article, we will talk about different status and progress elements available in Streamlit using Python. Let's see some different status and progress elements within Streamlite- Progress Bars Firstly we will see how we can add a progress bar to our Streamlit web app. Streamlit comes with a me
3 min read
Streamlit - Complete Setup Guide
Streamlit is an open-source app framework in python language. It helps us create beautiful web apps for data science and machine learning in a little time. It is compatible with major python libraries such as scikit-learn, keras, PyTorch, latex, numpy, pandas, matplotlib, etc. Syntax for installing
3 min read