Gradio 3.0 Release Notes

Hugging Face has released Gradio 3.0, a ground-up redesign of the library that introduces a new low-level API called Gradio Blocks and a modernized frontend to enable the creation of more complex and performant machine learning demos.

Gradio Blocks: Low-Level API for Custom Web Apps

Gradio Blocks is a new low-level language that allows developers to build complex custom web applications entirely in Python, providing greater control over layout and data flow than previous versions.

Blocks addresses specific limitations of standard Gradio demos by enabling:

  • Custom Layouts: Developers can move beyond the fixed input-on-left and output-on-right structure.
  • Flexible Data Flows: It supports multi-step interfaces where the output of one model serves as the input to another.
  • Dynamic Component Properties: The visibility or properties of a component (such as choices in a Dropdown) can be changed based on user input.

Frontend Redesign and Performance Improvements

Gradio 3.0 features a complete frontend overhaul designed to improve speed, visual integration, and user experience.

Technical Stack and Performance

The frontend has been migrated to modern technologies, specifically Svelte, resulting in smaller payloads and faster page load times.

UI/UX Enhancements

  • Visual Design: A cleaner design has been implemented to allow demos to fit more naturally into various settings, including embedding within blog posts via iframes.
  • Component Updates: Existing components have been revamped for better usability; for example, the Dataframe component now supports dragging and dropping CSV files.
  • New Components: New elements such as the Gallery component have been added to provide more UI options for model interaction.
  • TabbedInterface: A new TabbedInterface class allows developers to group related demos into multiple tabs within a single web application.

The Gradio Blocks Party

To encourage the adoption of the new Blocks API, Hugging Face organized the "Gradio Blocks Party," a competition running through the end of May 2022. The initiative aims to make state-of-the-art machine learning more accessible to non-engineers by incentivizing the creation of high-quality demos built with Blocks.

Sources