Get Started with the Hugging Face Inference API
Learn how to sign up for a Hugging Face account and retrieve the access token of the Hugging Face Inference API.
We'll cover the following
We need to complete a few steps before we can start using the Hugging Face Inference API.
Sign up and generate an access token
Visit the registration link and perform the following steps:
Enter a valid “Email address” and “Password.” Then, click the “Next” button.
On the new page, enter the required details, click on the user agreement checkbox, and then click the “Create Account” button.
You will receive a verification email. Click the verification link provided in the email. It opens a new page, as shown in slide 4.
Click the profile photo in the top-right corner. Then, click “Settings” from the drop-down list. This opens a new page.
Click the “Access Tokens” option from the left navbar on the new page.
Click the “New token” button. This opens a pop-up window.
Enter the “Name” for the token, select the “Role” as “read”, and click the “Generate a token” button. It generates an access token that we use for Hugging Face Inference API calls.
Save the API key
Let’s save the access token to use throughout the course. Follow the instructions below:
Click the “Edit” button in the following widget.
Enter your access token in the
ACCESS_TOKEN
field.Click the “Save” button.
Once the ACCESS_TOKEN
is saved, it can be used throughout the course. To verify that the provided token is valid, click the “Run” button for the widget below. You'll receive a success or error message accordingly.
token = "{{ACCESS_TOKEN}}";// Invoking the function to make an API calltestAPI(token);