Skip to content

aneagoie/smart-brain-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartBrain-api - Final

Final project for ZTM course

  1. Clone this repo
  2. Run npm install
  3. Run npm start
  4. You must add your own API key in the controllers/image.js file to connect to HuggingFace API (Clarifai API is no longer free). See below for how to set up HuggingFace account.
  5. Add your own database credentials to server.js

** Make sure you use postgreSQL instead of mySQL for this code base.

Get your access token

  • 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.

Notes on the code

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

About

Final project for ZTM course

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors