Lädt...


🔧 Building Your First Streamlit Application: A Beginner's Guide


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

Streamlit has been gaining popularity among data scientists and developers for its simplicity and effectiveness in turning data scripts into shareable web apps. In this post, we'll walk through the creation of a basic Streamlit application that demonstrates its core functionalities.

What is Streamlit?

Streamlit is an open-source Python library that makes it easy to create and share beautiful, custom web apps for machine learning and data science. In just a few minutes you can build and deploy powerful data apps - so let's get started.

Setting Up Your Environment

First, you need to install Streamlit. It's as simple as running this command in your Python environment:

pip install streamlit

Creating a Simple Streamlit App

Let’s create a basic app that takes user input and displays it. Open your favorite IDE or text editor, create a new Python file (app.py), and let's start coding.

Step 1: Import Streamlit

import streamlit as st

Step 2: Add Title and User Input

Streamlit makes it extremely easy to add elements to your app. Let's add a title and a text input field:

st.title('My First Streamlit App')

user_input = st.text_input("Enter some text")
st.write('The user entered:', user_input)

Step 3: Run Your App

Save your app.py and run it using the following command in your terminal:

streamlit run app.py

Your default web browser will open with your new Streamlit app. Try entering text in the input box, and you'll see the app respond in real-time.

Expanding Your App

Streamlit offers a wide range of options to make your app interactive. You can add sliders, buttons, charts, and even display data frames. Here's how you can add a slider and use it to filter data in a dataframe:

import pandas as pd
import numpy as np

# Create a sample dataframe
df = pd.DataFrame(np.random.randn(10, 2), columns=['A', 'B'])

# Add a slider
slider_val = st.slider('Select a range', 0, 10)

# Filter the dataframe
filtered_df = df[df['A'] > slider_val]

# Display the dataframe
st.write(filtered_df)

Conclusion

Streamlit is a powerful tool for quickly turning data scripts into interactive web apps. This post covered the basics, but there's so much more you can do with Streamlit. Dive into the Streamlit documentation to explore further, and don't forget to share your creations with the community!

...

🔧 Building Your First Streamlit Application: A Beginner's Guide


📈 54.65 Punkte
🔧 Programmierung

📰 How to Use Streamlit’s st.write Function to Improve Your Streamlit Dashboard


📈 38.34 Punkte
🔧 AI Nachrichten

📰 The Streamlit Colour Picker: An Easy Way to Change Chart Colours on Your Streamlit Dashboard


📈 38.34 Punkte
🔧 AI Nachrichten

📰 Streamlit from Scratch: Build a Data Dashboard with Streamlit's Layout and UI features


📈 35.09 Punkte
🔧 AI Nachrichten

🔧 Building Your First Android App: A Beginner's Guide


📈 31.21 Punkte
🔧 Programmierung

🔧 Building Your First AWS Web Server: A Beginner's Guide to Cloud Computing


📈 31.21 Punkte
🔧 Programmierung

🔧 A Beginner's Guide to Building Your First Flutter App


📈 31.21 Punkte
🔧 Programmierung

🔧 Building Your DevOps Playground: A Beginner's Guide to Setting Up Your Development Environment


📈 28.71 Punkte
🔧 Programmierung

🔧 Building a Full-Stack Web Application with MERN Stack: A Beginner's Guide


📈 28.11 Punkte
🔧 Programmierung

📰 A beginner’s guide to building a Retrieval Augmented Generation (RAG) application from scratch


📈 28.11 Punkte
🔧 AI Nachrichten

🔧 Building Your First Web Application: A Step-by-Step Guide


📈 27.22 Punkte
🔧 Programmierung

🔧 Building Your First Web Application with Flask: A Step-by-Step Guide


📈 27.22 Punkte
🔧 Programmierung

🔧 How-to Guide: Building Your First ASP.NET Core Web Application


📈 27.22 Punkte
🔧 Programmierung

🔧 Building Your First AI Application with Julep: A Step-by-Step Guide


📈 27.22 Punkte
🔧 Programmierung

🔧 Jetpack Compose Mastery Part 1: A Comprehensive Guide to Building Your First Compose Application


📈 27.22 Punkte
🔧 Programmierung

📰 Display your application data with Streamlit


📈 26.69 Punkte
🐧 Unix Server

🔧 Building Your Own Blockchain: A Beginner’s Guide to Setting Up and Using Cosmos


📈 25.47 Punkte
🔧 Programmierung

🔧 Building Your Django App: A Beginner's Guide (Part 2)


📈 25.47 Punkte
🔧 Programmierung

🎥 Creating your first application [6 of 51] | Beginner's Series to JavaScript


📈 24.78 Punkte
🎥 Video | Youtube

🔧 Dockerizing Your Application: A Beginner's Guide


📈 24.48 Punkte
🔧 Programmierung

🔧 Hosting Your Own Web Application: A Beginner's Guide with Nginx


📈 24.48 Punkte
🔧 Programmierung

🔧 Building an Interactive Web App With TiDB Cloud and Streamlit


📈 24.42 Punkte
🔧 Programmierung

🔧 Building Intelligent Chatbots With Streamlit, OpenAI, and Elasticsearch


📈 24.42 Punkte
🔧 Programmierung

🔧 Building a Chat with PDFs using Pinata,OpenAI,, and Streamlit


📈 24.42 Punkte
🔧 Programmierung

🔧 4 Streamlit Alternatives for Building Python Data Apps


📈 24.42 Punkte
🔧 Programmierung

🔧 Building internal AI tools with Streamlit


📈 24.42 Punkte
🔧 Programmierung

📰 From Zero to App: Building a Database-Driven Streamlit App with Python


📈 24.42 Punkte
🔧 AI Nachrichten

🔧 Building Interactive Applications with Amazon Bedrock, Amazon S3 and Streamlit


📈 24.42 Punkte
🔧 Programmierung

🔧 Building a Movie Recommendation System with Streamlit and Python


📈 24.42 Punkte
🔧 Programmierung

🔧 Building an HTML to ReactJS Converter with Streamlit and Lyzr Automata


📈 24.42 Punkte
🔧 Programmierung

🔧 Building Chat Applications with OpenAI's GPT-3.5-turbo using Streamlit, Chainlit, and Gradio


📈 24.42 Punkte
🔧 Programmierung

🔧 Building an Elearning Course Creator with Streamlit and Lyzr Automata


📈 24.42 Punkte
🔧 Programmierung

🔧 Building a Loan Underwriting Expert with Lyzr Automata,Streamlit and OpenAI


📈 24.42 Punkte
🔧 Programmierung

🔧 Building a Policy Information Chatbot with Streamlit and Lyzr


📈 24.42 Punkte
🔧 Programmierung

matomo