Initialization
To get started, first make sure you've imported the hub.php
library:
include 'hub.php';
Then, initialize a new HF Hub API object:
$api = new Hub('<your_hf_token>');
Note
Don't have a Hugging Face token yet? Get one here! All you need is a free Hugging Face account. Make sure the token's role is set to write
for all methods to work!
- Make sure your token begins with
hf_
! - Make sure not to share your token or publish code with your token. Check your code before open-sourcing it to ensure it doesn't have any tokens.