The key is connected fine, but the token is invalid? Is it related to billing?

#4
by BrightCLASS - opened

The key is connected fine, but the token is invalid?

{'error': 'Authorization header is correct, but the token seems invalid'}

Is it related to billing?

-------------- CODE ------------------
import requests

API_URL = "https://api-inference.huggingface.co/models/facebook/detr-resnet-101"
headers = {"Authorization": "Bearer YOUR_API_KEY_HERE"}

def query(filename):
with open(filename, "rb") as f:
data = f.read()
response = requests.post(API_URL, headers=headers, data=data)
return response.json()

output = query("cats.jpg")
print(output)

Sign up or log in to comment