October 11, 2024

Gradio 5.0 Release Enhances Machine Learning Application Development

Listen to this article as Podcast
0:00 / 0:00
Gradio 5.0 Release Enhances Machine Learning Application Development

Gradio 5.0 Released: New Features and Improvements for Machine Learning Applications

Gradio, a popular open-source Python framework for building user interfaces (UI) for machine learning models, has recently released its stable version 5.0. With over 2 million monthly users and over 470,000 applications on Hugging Face Spaces, Gradio has become a standard tool for developing, sharing, and using machine learning applications.

Highlights of Gradio 5.0

The new version focuses on addressing pain points reported by Gradio developers regarding the production readiness of applications. Key improvements include:

Enhanced Performance

Gradio 5.0 is served over server-side rendering (SSR) whenever possible, and especially on Hugging Face Spaces. This results in significantly faster loading times and improved search engine optimization (SEO).

Revamped User Interface

Many components in Gradio 5.0 have been redesigned with a modern UI, including buttons, tabs, sliders, JSON components, and the "ChatInterface" class for chatbot UIs. Frames, shadows, fonts, and colors in dark mode have been globally adjusted for a cleaner and more modern look.

Media Streaming

Streaming audio, images, and videos as both input and output is now fully supported. Gradio now uses the HTTP Live Streaming protocol for streaming media, which provides a significantly better user experience when streaming audio and video. Developers have more control over media streaming with intuitive parameters that allow them to control the frequency of streams and the queue for streaming demos.

Improved Security

As Gradio 5.0 is designed as a production-ready web framework for all kinds of machine learning applications, significant security improvements have been made, including a third-party audit.

Experimental AI Playground

Gradio now includes an AI-powered playground that allows developers to generate Gradio applications from a prompt and view the results directly in the browser. This AI playground is a useful tool for creating simple Gradio apps or making changes to existing ones.

Installation and Compatibility

Gradio 5.0 requires Python 3.10 or higher. Installation is done locally via the "pip install gradio --upgrade" command. For Hugging Face Spaces, upgrading to Gradio 5.0 can be done by updating the "sdk_version" to 5.0.0 in the "README.md" file.

Breaking Changes

Gradio 5.0 includes some breaking changes that affect security, performance, and developer experience. Major changes include:

  • Audio files are no longer automatically converted to WAV format.
  • Passing a tuple to the "gr.Code" component is no longer supported.
  • The "root" parameter in the "gr.FileExplorer" component has been removed.
  • The "signed_in_value" parameter in the "gr.LoginButton" component has been removed.
  • The "gr.LogoutButton" component has been removed.
  • SVGs are only accepted as input by the "gr.Image" component if "type=filepath".
  • The "height" parameter in the "gr.DataFrame" component has been renamed to "max_height".
  • The ".change()" event in the "gr.DataFrame" component is now also triggered when the header row values change.
  • The "likeable" parameter of the "gr.Chatbot" component has been removed.
  • By default, user messages in the chatbot cannot be "liked".
  • The "examples_per_page" parameter of the "gr.ChatInterface" component has been removed.
  • The default value of the "gr.Dropdown" component is now the first item in the list.
  • The default value of the "equal_height" parameter in the "gr.Row" component has been set to "False".
  • The "file_type" parameter for various file-based input components is now enforced in the backend.
  • The "info" parameter now accepts Markdown/HTML.
  • Pressing Enter will not submit a "gr.Textbox" or "gr.MultimodalTextbox" if they are empty.
  • For security reasons, only files in the current working directory or temporary directory can be returned from the prediction function.

Conclusion

Gradio 5.0 is a major release with numerous improvements and new features that make the framework more powerful, user-friendly, and secure. Upgrading to the new version is recommended for all developers who use Gradio to build machine learning applications.

Bibliography

https://github.com/gradio-app/gradio/issues/9463
https://gradio.app/
https://www.gradio.app/changelog
https://github.com/gradio-app/gradio
https://twitter.com/_akhaliq?lang=tr
https://www.reddit.com/r/StableDiffusion/comments/y56qb9/security_warning_do_not_use_share_in/
https://www.gradio.app/docs/gradio/interface