Closed
Description
Originally from @gary149 on slack (private link):
Instead of using dummy values like hf_xxxxxxxxxxxx
, it would be good if inference snippets could use the HF_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:
- curl should use
$HF_TOKEN
- python should use
os.environ["HF_TOKEN"]
(⚠ requiresimport os
in code snippet) - js shoud use
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.