File size: 574 Bytes
3bbfecd 3d8341c 3bbfecd 005418e 3bbfecd 005418e 3bbfecd bb478f9 3bbfecd bb478f9 3bbfecd bb478f9 3bbfecd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
from transformers import AutoFeatureExtractor, AutoModelForImageClassification
extractor = AutoFeatureExtractor.from_pretrained("swww/test")
model = AutoModelForImageClassification.from_pretrained("swww/test")
import requests
API_URL = "https://api-inference.huggingface.co/models/swww/test"
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") |