Gradio Agents & MCP Hackathon
WinnersGradio Agents & MCP Hackathon
Winners →Getting Started
QuickstartBuilding Interfaces
The Interface ClassMore On ExamplesFlaggingInterface StateReactive InterfacesFour Kinds Of InterfacesBuilding With Blocks
Blocks And Event ListenersControlling LayoutState In BlocksDynamic Apps With Render DecoratorMore Blocks FeaturesCustom CSS And JSUsing Blocks Like FunctionsAdditional Features
QueuingStreaming OutputsStreaming InputsAlertsProgress BarsBatch FunctionsSharing Your AppFile AccessMultipage AppsEnvironment VariablesResource CleanupThemesClient Side FunctionsView Api PageInternationalizationChatbots
Creating A Chatbot FastChatinterface ExamplesAgents And Tool UsageCreating A Custom Chatbot With BlocksChatbot Specific EventsCreating A Discord Bot From A Gradio AppCreating A Slack Bot From A Gradio AppCreating A Website Widget From A Gradio ChatbotData Science And Plots
Creating PlotsTime PlotsFilters Tables And StatsConnecting To A DatabaseStreaming
Streaming Ai Generated AudioObject Detection From Webcam With WebrtcObject Detection From VideoConversational ChatbotReal Time Speech RecognitionAutomatic Voice DetectionCustom Components
Custom Components In Five MinutesKey Component ConceptsConfigurationBackendFrontendFrequently Asked QuestionsPdf Component ExampleMultimodal Chatbot Part1Documenting Custom ComponentsGradio Clients And Lite
Getting Started With The Python ClientGetting Started With The Js ClientQuerying Gradio Apps With CurlGradio And Llm AgentsGradio LiteGradio Lite And Transformers JsFastapi App With The Gradio ClientMcp
Building Mcp Server With GradioFile Upload McpBuilding An Mcp Client With GradioUsing Docs McpOther Tutorials
Using Hugging Face IntegrationsGradio And CometGradio And ONNX On Hugging FaceGradio And Wandb IntegrationCreate Your Own Friends With A GanCreating A Dashboard From Bigquery DataCreating A Dashboard From Supabase DataCreating A Realtime Dashboard From Google SheetsDeploying Gradio With DiscoDeploying Gradio With DockerDeveloping Faster With Reload ModeFrom Openapi SpecHow To Use 3D Model ComponentImage Classification In PytorchImage Classification With Vision TransformersInstalling Gradio In A Virtual EnvironmentNamed Entity RecognitionPlot Component For MapsRunning Background TasksRunning Gradio On Your Web Server With NginxSetting Up A Demo For Maximum PerformanceStyling The Gradio DataframeTheming GuideUnderstanding Gradio Share LinksUsing FlaggingUsing Gradio For Tabular WorkflowsUsing Gradio In Other Programming LanguagesWrapping LayoutsYour dashboard will likely consist of more than just plots. Let's take a look at some of the other common components of a dashboard.
Use any of the standard Gradio form components to filter your data. You can do this via event listeners or function-as-value syntax. Let's look at the event listener approach first:
import gradio as gr
from data import df
with gr.Blocks() as demo:
with gr.Row():
origin = gr.Dropdown(["All", "DFW", "DAL", "HOU"], value="All", label="Origin")
destination = gr.Dropdown(["All", "JFK", "LGA", "EWR"], value="All", label="Destination")
max_price = gr.Slider(0, 1000, value=1000, label="Max Price")
plt = gr.ScatterPlot(df, x="time", y="price", inputs=[origin, destination, max_price])
@gr.on(inputs=[origin, destination, max_price], outputs=plt)
def filtered_data(origin, destination, max_price):
_df = df[df["price"] <= max_price]
if origin != "All":
_df = _df[_df["origin"] == origin]
if destination != "All":
_df = _df[_df["destination"] == destination]
return _df
demo.launch()
And this would be the function-as-value approach for the same demo.
import gradio as gr
from data import df
with gr.Blocks() as demo:
with gr.Row():
origin = gr.Dropdown(["All", "DFW", "DAL", "HOU"], value="All", label="Origin")
destination = gr.Dropdown(["All", "JFK", "LGA", "EWR"], value="All", label="Destination")
max_price = gr.Slider(0, 1000, value=1000, label="Max Price")
def filtered_data(origin, destination, max_price):
_df = df[df["price"] <= max_price]
if origin != "All":
_df = _df[_df["origin"] == origin]
if destination != "All":
_df = _df[_df["destination"] == destination]
return _df
gr.ScatterPlot(filtered_data, x="time", y="price", inputs=[origin, destination, max_price])
demo.launch()
Add gr.DataFrame
and gr.Label
to your dashboard for some hard numbers.
import gradio as gr
from data import df
with gr.Blocks() as demo:
with gr.Row():
gr.Label(len(df), label="Flight Count")
gr.Label(f"${df['price'].min()}", label="Cheapest Flight")
gr.DataFrame(df)
demo.launch()