File size: 437 Bytes
29007e0
6bc5425
 
 
 
29007e0
 
 
 
ffd20c7
 
c0c87ea
 
 
29007e0
6bc5425
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import requests
import os

WD = os.getcwd()
print(WD)

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(f"{WD}/04_deer.jpg")