Esta página se muestra en inglés. Una traducción al español está en curso.
SkillsApr 3, 2026·2 min de lectura

Mesop — Build AI Apps Fast with Python UI

Google's Python UI framework for rapidly building AI demos and internal tools. Declarative components, hot reload. 6.5K+ stars.

Introducción

Mesop is a Python UI framework by Google with 6,500+ GitHub stars for rapidly building AI demos, prototypes, and internal tools. It provides a declarative component model where you describe what your UI should look like, and Mesop handles the rendering. With built-in AI chat components, hot reload, and zero JavaScript requirement, you can go from Python script to interactive web app in minutes. Originally built at Google for internal AI demos, Mesop is now open-source and used by teams building LLM-powered interfaces.

Works with: Python, OpenAI, Anthropic, Google Gemini, any LLM API. Best for AI developers who want to build interactive demos and internal tools without web development skills. Setup time: under 2 minutes.


Mesop Features

Declarative UI

import mesop as me

@me.page(path="/")
def home():
    me.text("Hello World", type="headline-4")
    me.button("Click me", on_click=handle_click)
    me.input(label="Enter text", on_blur=handle_input)

def handle_click(e: me.ClickEvent):
    state = me.state(AppState)
    state.count += 1

@me.stateclass
class AppState:
    count: int = 0
    text: str = ""

Built-in AI Chat Component

import mesop.labs as mel

def transform(prompt: str, history: list) -> str:
    # Your LLM call here
    return call_llm(prompt)

@me.page(path="/chat")
def chat_page():
    mel.chat(
        transform,
        title="AI Assistant",
        bot_user="Assistant",
    )

This gives you a complete chat UI with:

  • Message history
  • Streaming responses
  • User/bot avatars
  • Input field with send button

State Management

@me.stateclass
class State:
    query: str = ""
    results: list[str] = []
    loading: bool = False

def search(e: me.ClickEvent):
    state = me.state(State)
    state.loading = True
    yield  # Update UI to show loading
    state.results = perform_search(state.query)
    state.loading = False
    yield  # Update UI with results

Components

Component Usage
me.text() Text display
me.button() Clickable button
me.input() Text input
me.textarea() Multi-line input
me.select() Dropdown
me.slider() Range slider
me.checkbox() Toggle
me.table() Data table
me.markdown() Render Markdown
me.plot() Matplotlib charts
mel.chat() Full chat interface

Hot Reload

Edit your Python file and the UI updates instantly — no restart needed.

Multi-Page Apps

@me.page(path="/")
def home(): ...

@me.page(path="/chat")
def chat(): ...

@me.page(path="/dashboard")
def dashboard(): ...

FAQ

Q: What is Mesop? A: Mesop is Google's open-source Python UI framework with 6,500+ GitHub stars for rapidly building AI demos and internal tools with declarative components, built-in chat UI, and hot reload.

Q: How is Mesop different from Streamlit or Gradio? A: Mesop uses a declarative component model (like React) instead of Streamlit's top-to-bottom rerun model. It has better state management and a built-in AI chat component. Gradio is focused on ML model demos; Mesop is for general-purpose AI apps.

Q: Is Mesop free? A: Yes, open-source under Apache-2.0.


🙏

Fuente y agradecimientos

Created by Google / Mesop Dev. Licensed under Apache-2.0.

mesop — ⭐ 6,500+

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.