What is Taipy?
Taipy is an innovative tool designed specifically for data scientists and machine learning engineers to build data-driven and AI-powered web applications effortlessly. It allows users to transition from simple pilot projects to fully-fledged production-ready web apps without making any compromises on performance, customization, or scalability. By using Taipy, you no longer need to learn new programming languages; everything is accomplished through Python, allowing you to focus on data and AI algorithms without getting bogged down in development and deployment complexities.
Key Features
- Python-Based Development: Taipy enables developers to build applications using just Python, bypassing the need for mastering additional languages.
- Rapid Web Application Development: Create production-ready applications quickly, benefiting from performance and scalability.
- UI Generation and Scenario & Data Management: Taipy offers a dual capability to assist in both UI design and effective data scenario management.
Quickstart
Getting started with Taipy is simple. To install the stable version of Taipy, execute the following command in your terminal:
pip install taipy
For more detailed instructions, including setting up within a Conda environment or installing from source, you can refer to the Installation Guide. Dive into the Getting Started Guide to unleash Taipy’s full potential.
Scenario and Data Management
Taipy facilitates creating scenarios that manage data effectively. For instance, consider a scenario that filters movie data based on selected genre preferences. This specific scenario sets up a simple pipeline that activates each time a user selects a different genre, showcasing the top seven popular movies within that category.
Here is a basic task example used within such a scenario:
def filter_genre(initial_dataset: pd.DataFrame, selected_genre):
filtered_dataset = initial_dataset[initial_dataset['genres'].str.contains(selected_genre)]
filtered_data = filtered_dataset.nlargest(7, 'Popularity %')
return filtered_data
Taipy can handle much more intricate pipelines beyond this simple task.
Taipy Studio
Taipy Studio is an extension for Visual Studio Code that allows developers to configure scenarios with a no-code approach. Your settings are stored automatically in a TOML file. For those who prefer writing code or dealing with more advanced cases, detailed scenarios can be crafted manually. Explore the Taipy Studio Documentation for a comprehensive guide.
User Interface Generation and Scenario & Data Management
To illustrate its capabilities, consider a simple Taipy application that acts as a film recommendation system. It filters a film dataset based on a user-selected genre and presents a list of the top seven films within that genre ranked by popularity.
Below is a concise version of the application code which handles both the interface and data processing:
import taipy as tp
import pandas as pd
from taipy import Config, Scope, Gui
# Defining the helper functions
def on_genre_selected(state):
scenario.selected_genre_node.write(state.selected_genre)
tp.submit(scenario)
state.df = scenario.filtered_data.read()
def on_init(state):
on_genre_selected(state)
def filter_genre(initial_dataset: pd.DataFrame, selected_genre):
filtered_dataset = initial_dataset[initial_dataset['genres'].str.contains(selected_genre)]
filtered_data = filtered_dataset.nlargest(7, 'Popularity %')
return filtered_data
if __name__ == "__main__":
Config.load("config.toml")
scenario_cfg = Config.scenarios["scenario"]
tp.Orchestrator().run()
scenario = tp.create_scenario(scenario_cfg)
genres = [
"Action", "Adventure", "Animation", "Children", "Comedy", "Fantasy", "IMAX",
"Romance", "Sci-Fi", "Western", "Crime", "Mystery", "Drama", "Horror", "Thriller", "Film-Noir", "War", "Musical", "Documentary"
]
df = pd.DataFrame(columns=["Title", "Popularity %"])
selected_genre = "Action"
my_page = """
# Film Recommendation
## Choose Your Favorite Genre
<|{selected_genre}|selector|lov={genres}|on_change=on_genre_selected|dropdown|>
## Here are the Top Seven Picks by Popularity
<|{df}|chart|x=Title|y=Popularity %|type=bar|title=Film Popularity|>
"""
Gui(page=my_page).run()
The resulting application gives users an interactive and engaging experience, allowing them to explore movie recommendations effortlessly. The development power of Taipy is visualized through its sleek, comprehensive user interfaces and professional-level scenario and data management capabilities.