This project aims to present an alternative to deploy a ML model using 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!"
- Knowledge about how to train, fit and save a model
- Set your python environment
- Install Gradio
- Import the required libraries (assuming you have already saved your model using Joblib)
- Creating a function by which Gradio will present the predicted price
You can find this model here: https://github.com/domingosdeeulariadumba/LaptopPriceAnalysis
- Setting up the entries
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
- Defining the output
As the goal of this project was to predict laptop prices, we set the price as the outcome.
- Defining the interface entries
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.
- Deploying the model
And finally we launch the model. At this point, all we can do is copy the url and check how it looks like.
-
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/
-
Build & Share Delightful Machine Learning Apps. Gradio. https://www.gradio.app/docs/interface