Final project for ZTM course
- Clone this repo
- Run
npm install - Run
npm start - You must add your own API key in the
controllers/image.jsfile to connect to HuggingFace API (Clarifai API is no longer free). See below for how to set up HuggingFace account. - Add your own database credentials to
server.js
** Make sure you use postgreSQL instead of mySQL for this code base.
- Go to HuggingFace and register for an account
- Go to settings > access tokens and create a new token
- Use a fine grained token and add "Make calls to Inference Providers" permission
- Create token and save somewhere you won't lose it. This token you will use inside
controllers/image.js.
The HuggingFace api for this takes the image as a Blob type. So if you want to use an image url string, then you need to convert it. The first lines of the sendImageToHuggingFace do that:
const response = await fetch(imageUrl);
const imageBlob = await response.blob();visist https://zerotomastery.io/ for more