Create a basic webpage
Create a basic Streamlit webpage
Categories:
4 minute read
This was performed on Windows 11
Install Streamlit
- Install Streamlit
Create a Python file
- Put it in a working directory
- Name the file
app.py
Create some simple initial content and test
- In the
app.py
file create the following Python code.
To test the code in a Terminal browse to the working directory and run:
Add 2 columns with some text and an animation
- Add the following section to create two columns.
- The first column on the left of the screen will have text
- The second column on the right of the screen will have an animation; detailed in the next section.
Add an animation to the second column
- Install the streamlit Lottie library on your workstation
- Install the requests library
- Then add the import to the
app.py
file
- Create a function to get the JSON data from the Lottie URI
- Go to the lottie file website and choose an animation
- Once loaded, copy the animation asset link URI
- In the
app.py
file create a new constants section and add the asset link URI
- Add the function in front of the lottie_coding URI
Use CSS style
- Create a new folder and file
./style/style.css
- Insert the following code which will style the website
- In the
app.py
file create a new function block - This function will get the style.css file and convert it to markdown
- Define the path to the CSS file in the constants section
- Call the function and define the path to the CSS file
Use a Streamlit theme to change the webpage colors
- Create a new folder and file
./.streamlit/config.toml
- Insert the following code which will style the website
Final code
The code can be viewed on my GitHub page.
grinntec/ShowcaseHub/streamlit/basic-webpage/
+---working-directory
| +---.streamlit
| | config.toml
| +---style
| | style.css
| app.py
References
Feedback
Was this page helpful?
Glad to hear it!
Sorry to hear that.