[InferenceSnippet] If access token is not provided, default to HF_TOKEN
environment variable
#1361
Labels
inference
@huggingface/inference related
Originally from @gary149 on slack (private link):
Instead of using dummy values like
hf_xxxxxxxxxxxx
, it would be good if inference snippets could use theHF_TOKEN
env variable by default - if nothing is provided. Would allow to be able to directly copy-paste the snippets and run them if env variable exists.In practice:
$HF_TOKEN
os.environ["HF_TOKEN"]
(⚠ requiresimport os
in code snippet)process.env.HF_TOKEN
We still want to be able to pass a custom key to
getInferenceSnippets
and have it work with it (typically for direct calls without routing).We want it to work with as many clients and tasks as possible but if too difficult to have a 100% coverage, let's focus on the most important ones.
The text was updated successfully, but these errors were encountered: