Seems token issue or under maintain.
HF_TOKEN = "hf_my_valid_pro_token"
#HF_TOKEN = False # if use it, fails with 503 error
from huggingface_hub import InferenceClient
client = InferenceClient(
provider="hf-inference",
api_key=HF_TOKEN
)
messages = [
{
"role": "user",
"content": "What is the capital of France?"
}
]
completion = client.chat.completions.create(
model="amusktweewt/tiny-model-500M-chat-v2",
messages=messages,
max_tokens=500,
)
print(completion.choices[0].message)
# ChatCompletionOutputMessage(role='assistant', content='OUP for France - reduced price comparison board (BUFF) is the payoff for carbon emissions.', tool_calls=None)