What is a virtual environment? Virtual environments are useful tools in Python development that allow you to isolate package installations related to a specific project from the main system’s Python installation. This means you can have separate environments with different package dependencies for different projects. Creating a virtual environment is easy using the venv module […]
Installing and launching Streamlit – Exploring Streamlit’s Features and Functionality
Installing and launching Streamlit Finally, we are ready to write our code to create beautiful web applications! Where do we start? The first thing we must do is install Streamlit. So, let’s create a new directory – we will call it streamlit_course. Once you’re inside it, prepare a new virtual environment by typing the well-known […]
Streamlit features and widgets – Exploring Streamlit’s Features and Functionality
Streamlit features and widgets The very first step has been completed: Streamlit is up and running. What we need to do now is add text, widgets, elements, and more to make something beautiful that also works correctly. To start populating our web app with nice and useful widgets, we need to write some Python code. […]
Colored textboxes – Exploring Streamlit’s Features and Functionality
Colored textboxes In terms of text, we can have beautiful textboxes consisting of different colors to indicate a warning, an error, and so on. This kind of color code can be very useful when we’re building our web application. Let’s take a look at the code:st.success(“Success!”)st.info(“Information”)st.warning(“This is a warning!”)st.error(“This is an error!”) The first piece […]
Inputting text and numbers – Exploring Streamlit’s Features and Functionality
Inputting text and numbers Another extremely useful function in our web application is inputting, which is the process of entering some information. In this case, we have many widgets available out of the box. In the text_input widget, we only have to specify a label or caption and a placeholder – very easy!Name = st.text_input(“Your […]
DataFrames, plots, and visualizations – Exploring Streamlit’s Features and Functionality
DataFrames, plots, and visualizations Now, it’s time to deal with DataFrames, so let’s comment on something and continue exploring widgets. DataFrame is the name that the pandas library gives to its data. When a file, such as a CSV file, is imported into pandas, the result will be a DataFrame. We can think of a […]
Date, time, and more – Exploring Streamlit’s Features and Functionality
Date, time, and more Another very useful element that we can manage out of the box in Streamlit is date and time – that is, dates, hours, and so on. For example, to print today’s date on the screen, we just have to write the following:import datetimetoday = st.date_input(“Today is”,datetime.datetime.now()) Here, the first line simply […]
Configuring our environment – Streamlit Essentials – Configuring the Environment, Managing Packages, and More
Configuring our environment We are finally here and building our first web application from scratch! From scratch means working from the beginning, even before an empty Python file. The approach is easy – we start by sitting and coding together. Let’s start by creating our virtual environment, which is dedicated exclusively to this new app […]
Installing and importing packages – Streamlit Essentials – Configuring the Environment, Managing Packages, and More
Installing and importing packages To make our web application work properly, we need the following Python packages: We can install all these packages in our virtual environment (so we must already be inside the virtual environment) by typing the following unique instruction:pipenv install streamlit textblob spacy neattext matplotlib wordcloud Please note that this operation can […]
App skeleton building 2 – Streamlit Essentials – Configuring the Environment, Managing Packages, and More
Now, save the app.py file and click on Always rerun in the web app (in the top-right corner); in this way, all the new lines of code will be immediately executed as soon as we save them. As shown in Figure 4.11, we have added the menu on the left-hand side of our web app. […]