Interfaces for your ML Models
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()
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()
import gradio as gr def face_segmentation(img): # ... implement face segmentation model on input 200x200 numpy array # ... return segmentation mask as numpy array webcam = gr.inputs.Image(shape=(200, 200), source="webcam") gr.Interface(fn=face_segmentation, inputs=webcam, outputs="image").launch()
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 = gr.inputs.Slider(1, 5) month = gr.inputs.Dropdown(["May", "June", "July"]) countries = gr.inputs.CheckboxGroup(["USA", "Canada", "Mexico", "UK"]) gr.Interface(fn=outbreak_forecast, inputs=[r, month, countries, "checkbox"], outputs="plot").launch()
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 >>
Once you've created an interface, you can point Gradio towards the GitHub repository where it is contained. Gradio will host the interface on its servers and provide you with a link you can share.
More on Hosting >>
If you haven't typed:
$ 𝚙𝚒𝚙 𝚒𝚗𝚜𝚝𝚊𝚕𝚕 𝚐𝚛𝚊𝚍𝚒𝚘
yet, now would be a damn good time.
Especially if you are working in computer vision & deploying models in the real world. twitter.com/abidlabs/statu...
In other news, proud to share what the
@GradioML team has been working on for the past few weeks! Just released 1.3.0, which has 3 big updates:
1. INTERPRETATIONS: You can get out-of-the-box interpretations for any regression / classification model in 1 line of code:
@GradioML deploy your model is like a test-of-time award, except it’s test-of-now. Open implementation, clear code, and actionable dataset has to skew towards better papers. twitter.com/GradioML/statu...
We took 5 of our favorite
#NeurIPS2020 papers and created web demos from their public code using @GradioML. So that anyone can use the models, right from your browser! #accessibility #reproducibility
The models & links to the web demos are below:
I recorded a quick tutorial covering all of the core features of the
@GradioML Python library
- creating GUIs to demo ML models
- deploying via share links
- visualizing interpretations
- seeing embeddings
What other features would you like to see?
Have questions, or want to integrate Gradio in a large team? Get in touch.
Running into any technical issues? Open an issue at our github repo.