Interfaces for your ML Models

Generate an easy-to-use UI for your ML model, function, or API with only a few lines of code. Integrate directly into your Python notebook, or share a link with anyone.

Gradio allows you to quickly create customizable UI components around your TensorFlow or PyTorch models, or even arbitrary Python functions. Mix and match components to support any combination of inputs and outputs. Our core library is free and open-source!

Below are a few demos. Check the Getting Started for full code examples.

import gradio as gr

def recognize_digit(img):
    # ... implement digit recognition model on input array 
    # ... return dictionary of labels and confidences 

gr.Interface(fn=recognize_digit, inputs="sketchpad", outputs="label").launch()
The single line of code above produces the web interface below. Draw a number 0 through 9 on the sketchpad below and see predictions in real time!
import gradio as gr

def answer_question(paragraph, question):
    # ... implement Q&A model
    # ... return answer to question

gr.Interface(fn=answer_question, inputs=["textbox", "text"], outputs="text").launch()
Provide a context paragraph and ask a question that can be answered with the context information. Go ahead, type in some information and a question. Then, click submit to get the answer!
import gradio as gr

def face_segmentation(img):
    # ... implement face segmentation model on input 200x200 numpy array
    # ... return segmentation mask as numpy array

webcam =, 200))
gr.Interface(fn=face_segmentation, inputs=webcam, outputs="image").launch()
Take a snapshot from your webcam and click submit to generate a face segmentation.
import gradio as gr, matplotlib.pyplot as plt

def outbreak_forecast(r, month, countries, social_distancing):
    # ... run model to forecast outbreak and generate plots
    # ... return plt

r =, 5)
month =["May", "June", "July"])
countries =["USA", "Canada", "Mexico", "UK"])

    inputs=[r, month, countries, "checkbox"], outputs="plot").launch()
Provide the parameters below and click submit to view the forecast of a simulated disease outbreak. This is not based on an actual disease and uses synthetic data.
Built to integrate with

Fast, easy setup

Gradio can be installed directly through pip. Creating a Gradio interface only requires adding a couple lines of code to your project. You can choose from a variety of interface types to interface your function.

More on Getting Started >>

Present and share

Gradio can be embedded in Python notebooks or presented as a webpage. A Gradio interface can automatically generate a public link you can share with colleagues that lets them interact with the model on your computer remotely from their own devices.

More on Sharing >>

Gradio is now an essential part of our ML demos. All it takes is a few minutes to make a demo come to life.
- Mohamed El-Geish, Director of AI at Cisco
Gradio accelerated our efforts to build and demo interdisciplinary models by quickly letting clinicians interact with machine learning models without writing any code. It's a huge time-saver!
- David Ouyang, Cardiologist at Stanford Medicine

Contact Us.

Want to integrate Gradio in a large team? We can help with Gradio for Teams. Get in touch.

Running into any issues? Open a open an issue at our github repo.