Source-linked AI summary

Gradio: Hassle-Free Sharing and Testing of ML Models in the Wild

Abubakar Abid, Ali Abdalla, Ali Abid, Dawood Khan, Abdulrahman Alfozan, James Zou

arXiv:1906.02569v1cs.LGcs.HCstat.ML

TL;DR

ML collaborators and end users often lack accessible ways to test models, limiting direct feedback and exposure to real-world cases. The paper presents Gradio, an open-source Python package that creates shareable visual interfaces, and evaluates it in a cardiology collaboration. In the pilot, the cardiologist interactively probed the model and gained confidence, while the study remained limited to one user pair over a short period.

  • Problem

    Domain experts without ML or coding backgrounds have limited ability to test models directly, making collaboration, real-world evaluation, and trust more difficult.

  • Method

    The authors developed Gradio, informed its design through interviews with 12 ML researchers, and evaluated it in a researcher–cardiologist case study.

  • Results

    In the pilot, the cardiologist tested personal and manipulated ultrasound images, flagged problematic cases, and gained more confidence and trust in the model.

  • Takeaways & Limitations

    Gradio enables collaborators and end users to interact with ML models without code, provide feedback, and test models in realistic settings.

  • Takeaways & Limitations

    The pilot study was limited to one user pair and a short time.

Abstract

from arXiv · show

Accessibility is a major challenge of machine learning (ML). Typical ML models are built by specialists and require specialized hardware/software as well as ML experience to validate. This makes it challenging for non-technical collaborators and endpoint users (e.g. physicians) to easily provide feedback on model development and to gain trust in ML. The accessibility challenge also makes collaboration more difficult and limits the ML researcher's exposure to realistic data and scenarios that occur in the wild. To improve accessibility and facilitate collaboration, we developed an open-source Python package, Gradio, which allows researchers to rapidly generate a visual interface for their ML models. Gradio makes accessing any ML model as easy as sharing a URL. Our development of Gradio is informed by interviews with a number of machine learning researchers who participate in interdisciplinary collaborations. Their feedback identified that Gradio should support a variety of interfaces and frameworks, allow for easy sharing of the interface, allow for input manipulation and interactive inference by the domain expert, as well as allow embedding the interface in iPython notebooks. We developed these features and carried out a case study to understand Gradio's usefulness and usability in the setting of a machine learning collaboration between a researcher and a cardiologist.

1. Introduction

Interdisciplinary ML collaborations often leave domain experts unable to directly test models, limiting feedback and exposure to real-world data. Gradio addresses this accessibility gap with shareable visual interfaces for code-free interaction and feedback.

  • Domain experts typically provide datasets and high-level feedback but cannot directly test ML models without coding or ML expertise.
  • Limited model access makes it harder for collaborators to judge performance and communicate useful feedback for improvement.
  • Fixed training datasets may omit real-world artifacts and domain shifts that experts could expose through direct model access.
  • Gradio is an open-source Python package that rapidly creates web-based visual interfaces for image, audio, and text models.
  • Researchers can share model links for browser-based use, while domain experts can flag individual samples to complete the feedback loop.

2. Motivation

Prior interfaces were often limited to particular frameworks or application domains, motivating requirements for a broader collaboration tool. Interviews with 12 ML researchers shaped Gradio’s support for varied models, sharing, input manipulation, and notebook or website embedding.

  • Motivation: Existing visual interfaces were commonly restricted to a specific ML framework or application domain, limiting their suitability for users’ work.
  • Design Requirements: Interviews with 12 interdisciplinary ML researchers identified Gradio’s key design requirements.
  • Design Requirements: Gradio should support intuitive text, image, and audio interfaces across Scikit-Learn, TensorFlow, and PyTorch models.
  • Design Requirements: Researchers wanted easily shareable model links without specialized packaging or hosting-server uploads.
  • Design Requirements: Domain experts should manipulate inputs through operations such as cropping, occlusion, text editing, audio noise, or video trimming.
  • Design Requirements: Interfaces should run in and embed within Jupyter or Colab notebooks and websites for collaborator or public testing.

3. Implementation

Gradio wraps existing ML models in configurable Python interfaces that can launch locally, inline, or through public links. Users interact through browsers while computation remains on the developer’s computer and feedback returns to the host.

  • Interface Construction: Developers create an Interface object by specifying input and output interfaces, model type, model, and optional preprocessing or postprocessing.
  • Interface Construction: Standard interfaces currently handle image, text, and audio data, while supported model types include Keras, PyTorch, Scikit-Learn, and arbitrary Python functions.
  • Launching and Sharing: The launch function controls browser or inline display, compatibility validation, and creation of a public share link.
  • Remote Interaction: Users can manipulate inputs in the browser, while encrypted data travels through an SSH tunnel to the developer’s computer for inference.
  • Remote Interaction: Flagged incorrect outputs send inputs, outputs, and messages back to the ML researcher, closing the feedback loop.

4. Pilot Study: Echocardiogram Classification

A pilot study examined Gradio in an ML researcher–cardiologist collaboration for pacemaker detection in echocardiograms. The cardiologist tested personal and transformed images, identified a robustness failure, and sent problematic cases back to the researcher.

  • Study Setup: The pilot involved an ML researcher and cardiologist using a pacemaker-detection model with AUC 0.93 on binary classification.
  • Without Gradio: Before Gradio, the cardiologist supplied monthly video batches and received metrics, but the researcher did not share the model directly.
  • With Gradio: With Gradio, the cardiologist immediately tested a personal ultrasound image and manipulated it to probe the model’s behavior.
  • With Gradio: Occluding the pacemaker changed the prediction from pacemaker present to no pacemaker, prompting relief from both participants.
  • Model Feedback: The cardiologist tested harder images and regional occlusions, generally finding accurate and robust predictions.
  • Model Feedback: Flipping images vertically generally reduced prediction accuracy, and the cardiologist flagged problematic samples for researcher analysis.
  • Observed Use: The researcher shared the URL directly, while the interface’s share button and notebook embedding were not used.
  • Requested Features: Users requested pre-supplied image sets and saliency maps to support image selection and occlusion choices.

5. Discussion & Next Steps

Gradio lowers the barrier for collaborators to create, share, and interact with machine learning models without writing code. A preliminary case study examined its usefulness and usability, while the authors identify broader evaluation and feature-development needs.

  • Gradio lets machine learning researchers create visual interfaces and share models with collaborators, who can interact with them without writing code.
  • These interactions allow collaborators and end users to test models in realistic settings and provide feedback or new data for models intended to work in the wild.
  • The authors expect Gradio to lower accessibility barriers and enable domain experts to participate more strongly in model development.
  • A case study with an ML researcher and cardiologist evaluated Gradio while detecting pacemakers in ultrasound images.
  • The case study was limited to one user pair and a short period, motivating additional usability studies and quantitative measures of trust and satisfaction.
  • Planned features include saliency tools, support for tabular and bulk inputs, and ways to connect ML researchers with domain experts they do not already know.
Loading 1906.02569v1…