In this tutorial, we'll take your trained model and make it accessible to anyone in the world through Hugging Face Spaces.
Hugging Face adds that extra magic specifically designed for machine learning projects. When combined with Gradio, a powerful tool for creating web interfaces, your sophisticated model becomes a user-friendly application that anyone can interact with.
To create a project, we navigate to https://huggingface.co/spaces and give it a descriptive name like food_classifier.
We then choose Gradio as our "Space SDK." Let's choose a "Blank" Gradio template.
Preparing Our Code with Jupyter Notebook and nbdev. We create a new Jupyter Notebook to write the code that will power our Gradio interface on Hugging Face Spaces.
We then install Gradio using this simple command: !pip install gradio==4.4.1
We’ve seen that our model can accurately predict the class of individual images. Now, let’s encapsulate this prediction logic into a function that will be the core of our Gradio application.
Gradio is a fantastic library that allows us to quickly create interactive web interfaces for our machine learning models, making them accessible and engaging.
With just a few steps, we’ve gone from a Jupyter Notebook to a live, deployed application. You can see the result right in your browser at our HuggingFace Space: huggingface.co/spaces/joonieoops/food_classifier.
If you’re looking to go beyond Gradio’s built-in UI, you’re in luck! Hugging Face Spaces provides a way to interact with your model through a set of APIs.