I am trying to get through this React tutorial - https://youtu.be/x4rFhThSX04?si=Viw7bG4tY4H5ZqL7. Part of the final project includes an API call to a HuggingFace AI model. We’re supposed to simply copy the code that calls the API - since this is a project about learning React, not AI. But even though I have copied the code, I am getting a 400 error - which means my request was invalid. But my code looks exactly like the one from the tutorial (as instructed). I don’t know much about AI APIs so if someone can help me debug this so I can move ahead with learning React, I would really appreciate it.
This is the code from the tutorial that I copied - learn-react/03. React State/55. Challenge - Get recipe from the AI chef/ai.js at main · scrimba/learn-react · GitHub
Note that since I am using my own machine and not the Scrimba platform to take this tutorial, I had to make a couple of updates in my code, specifically:
import { InferenceClient } from “@huggingface/inference”
const hf = new InferenceClient(import.meta.env.VITE_HF_ACCESS_TOKEN)
Everything else is the same.
I have tried asking ChatGPT, Claude AI to no avail. And I cant seem to get past the captcha page for Scrimba Discord.
Thanks in advance.