File size: 390 Bytes
29007e0
 
 
 
 
ffd20c7
 
c0c87ea
 
 
29007e0
4f87271
1
2
3
4
5
6
7
8
9
10
11
12
13
import requests

API_URL = "https://api-inference.huggingface.co/models/facebook/detr-resnet-50-panoptic"
headers = {"Authorization": "Bearer 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"}

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")