Skip to content

domingosdeeulariadumba/MLmodel_webapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Deploying a ML model using Gradio

This project aims to present an alternative to deploy a ML model using Gradio

What is Gradio?

According to their officioal webpage, "Gradio is the fastest way to demo your machine learning model with a friendly web interface so that anyone can use it, anywhere!"

Prerequisites

  1. Knowledge about how to train, fit and save a model
  2. Set your python environment

How to deploy a model using Gradio?

  1. Install Gradio

image

  1. Import the required libraries (assuming you have already saved your model using Joblib)

image

  1. Creating a function by which Gradio will present the predicted price

image

You can find this model here: https://github.com/domingosdeeulariadumba/LaptopPriceAnalysis

  1. Setting up the entries

image

The term 'label' represents the component or the message that will be displayed. We set 'Number' for numeric entries and 'Textbox' to pass non numeric inputs

  1. Defining the output

image

As the goal of this project was to predict laptop prices, we set the price as the outcome.

  1. Defining the interface entries

image

The 'fn' is a function of the Interface class used "to wrap an interface around. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component." We then iclude the inputs and the output defined in the steps 4 and 5.

  1. Deploying the model

image

And finally we launch the model. At this point, all we can do is copy the url and check how it looks like.

References

  1. How to Deploy a Machine Learning Model as a Web App Using Gradio. Ibrahim Abayomi Ogunbiyi. https://www.freecodecamp.org/news/how-to-deploy-your-machine-learning-model-as-a-web-app-using-gradio/

  2. Build & Share Delightful Machine Learning Apps. Gradio. https://www.gradio.app/docs/interface

About

Deploying a ML model as a Web app using Gradio.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages