User interfaces with Gradio for AI model inference in OSCAR services

User interfaces with Gradio for AI model inference in OSCAR services

Thursday, September 8, 2022

What is Gradio?

Gradio is a Python library for building user web interfaces for Machine Learning (ML) applications. Those interfaces can be customized with the components that Gradio provides, like Textbox, File, Video, Audio, Image, and Dataframe in a short period, saving time. Also, an authentication process can be implemented to grant access to the user for model inference. This allows to create nice web-based user interfaces for the inference process of a ML application.

OSCAR can be employed as a serverless platform for AI model inference. Therefore, Gradio stands out as a perfect match to create customized user interfaces for AI model inference.

Gradio in OSCAR

Gradio provides a user-friendly web-based interface to use an OSCAR service for AI inference, thus abstracting all the technology being used under the hood.

Gradio is deployed inside a Pod in the same Kubernetes cluster that runs the rest of the OSCAR services.

The interaction between Gradio and OSCAR can be done through synchronous invocations via the OSCAR REST API, which executes KNative under-the-hood to perform the AI model inference. Asynchronous invocations via uploading a file to MinIO can also be achieved.

gradio-oscar.png

Using Gradio for Stable Difussion in OSCAR

Stable Diffusion is an open-source AI model that provides impressive text-to-image generation capabilities.

Each Gradio application must be integrated with a specific OSCAR service. We produced a Gradio application with the Stable Diffusion service for OSCAR as an example on GitHub.

As shown in the picture below, the usage of web-based user interfaces produced by Gradio simplify the interaction with the OSCAR service for AI model inference, since the user no longer needs to query a REST API, or upload a file to MinIO, or use the OSCAR command-line interface to trigger the AI model inference.

stable-difussion.png

More visualization examples with Gradio will be published in the oscar-gradio repository.

OSCAR is developed by the GRyCAP research group at the Universitat Politècnica de València.