Hosting a pre-trained ML model is called inference. I just want to drop in some Python ML code and quickly get a REST API, but finding a simple way to

Building an AI powered REST API with Gradio and Huggingface Spaces – for free!

submited by
Style Pass
2022-12-03 17:31:11

Hosting a pre-trained ML model is called inference. I just want to drop in some Python ML code and quickly get a REST API, but finding a simple way to do this has proven more difficult than I expected.

There are plenty of hosting providers, including the big ones like Amazon AWS and Google GCP, but the process of using these are complex and often requires building your own Flask REST API.

Huggingface is like GitHub but for ML models and apps. A “Space” on Huggingface is an ML app that you can update via Git. Spaces are priced based on CPU type, and the simplest one is free!

I struggled with some errors in my live environment on Huggingface, until I realized I had to lock down the Python version to be the same as I use locally. By running:

REST API interface: At the bottom of the page you have a link called “Use via API”. Click it for instructions, but you can now call your app with REST:

Leave a Comment