Downloads · 30 days
0
Abhilashvj/CIRCL_website_classifier
CIRCL_website_classifier is a image classification model from Abhilashvj. Use it when you need a label for an image. It is set up for generic. The card lists the license as apache-2.0.
The endpoint expects the image to be served as binary. Below is an curl and python example
Downloads · 30 days
0
Access
Public
Updated May 27, 2023
Repo size
44.8 MB
Likes
1
Public
Click a slice to open those files.
.pth44.8 MB · 100%
From the Hugging Face model README
The endpoint expects the image to be served as binary. Below is an curl and python example
wget https://fki.tic.heia-fr.ch/static/img/a01-122-02-00.jpg -O test.jpg
curl --request POST \
--url https://{ENDPOINT}/ \
--header 'Content-Type: image/jpg' \
--header 'Authorization: Bearer {HF_TOKEN}' \
--data-binary '@test.jpg'
{"text": "INDLUS THE"}
wget https://fki.tic.heia-fr.ch/static/img/a01-122-02-00.jpg -O test.jpg
import json
from typing import List
import requests as r
import base64
ENDPOINT_URL=""
HF_TOKEN=""
def predict(path_to_image:str=None):
with open(path_to_image, "rb") as i:
b = i.read()
headers= {
"Authorization": f"Bearer {HF_TOKEN}",
"Content-Type": "image/jpeg" # content type of image
}
response = r.post(ENDPOINT_URL, headers=headers, data=b)
return response.json()
prediction = predict(path_to_image="test.jpg")
prediction
expected output
{"text": "INDLUS THE"}