philschmid / clip-zero-shot-image-classification

huggingface.co
Total runs: 26
24-hour runs: 0
7-day runs: -1
30-day runs: -13
Model's Last Updated: June 02 2023
zero-shot-image-classification

Introduction of clip-zero-shot-image-classification

Model Details of clip-zero-shot-image-classification

Fork of openai/clip-vit-base-patch32 for a zero-sho-image-classification Inference endpoint.

This repository implements a custom task for zero-shot-image-classification for 🤗 Inference Endpoints. The code for the customized pipeline is in the pipeline.py .

To use deploy this model a an Inference Endpoint you have to select Custom as task to use the pipeline.py file. -> double check if it is selected

expected Request payload
{
  "image": "/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAMCAgICAgMC....", // base64 image as bytes
  "candiates":["sea","palace","car","ship"]
}

below is an example on how to run a request using Python and requests .

Run Request
  1. prepare an image.
!wget https://huggingface.co/datasets/mishig/sample_images/resolve/main/palace.jpg
  1. run request
import json
from typing import List
import requests as r
import base64

ENDPOINT_URL = ""
HF_TOKEN = ""


def predict(path_to_image: str = None, candiates: List[str] = None):
    with open(path_to_image, "rb") as i:
        b64 = base64.b64encode(i.read())

    payload = {"inputs": {"image": b64.decode("utf-8"), "candiates": candiates}}
    response = r.post(
        ENDPOINT_URL, headers={"Authorization": f"Bearer {HF_TOKEN}"}, json=payload
    )
    return response.json()


prediction = predict(
    path_to_image="palace.jpg", candiates=["sea", "palace", "car", "ship"]
)

expected output

[{'label': 'palace', 'score': 0.9996134638786316},
 {'label': 'car', 'score': 0.0002602009626571089},
 {'label': 'ship', 'score': 0.00011758189066313207},
 {'label': 'sea', 'score': 8.666840585647151e-06}]

Runs of philschmid clip-zero-shot-image-classification on huggingface.co

26
Total runs
0
24-hour runs
-4
3-day runs
-1
7-day runs
-13
30-day runs

More Information About clip-zero-shot-image-classification huggingface.co Model

clip-zero-shot-image-classification huggingface.co

clip-zero-shot-image-classification huggingface.co is an AI model on huggingface.co that provides clip-zero-shot-image-classification's model effect (), which can be used instantly with this philschmid clip-zero-shot-image-classification model. huggingface.co supports a free trial of the clip-zero-shot-image-classification model, and also provides paid use of the clip-zero-shot-image-classification. Support call clip-zero-shot-image-classification model through api, including Node.js, Python, http.

clip-zero-shot-image-classification huggingface.co Url

https://huggingface.co/philschmid/clip-zero-shot-image-classification

philschmid clip-zero-shot-image-classification online free

clip-zero-shot-image-classification huggingface.co is an online trial and call api platform, which integrates clip-zero-shot-image-classification's modeling effects, including api services, and provides a free online trial of clip-zero-shot-image-classification, you can try clip-zero-shot-image-classification online for free by clicking the link below.

philschmid clip-zero-shot-image-classification online free url in huggingface.co:

https://huggingface.co/philschmid/clip-zero-shot-image-classification

clip-zero-shot-image-classification install

clip-zero-shot-image-classification is an open source model from GitHub that offers a free installation service, and any user can find clip-zero-shot-image-classification on GitHub to install. At the same time, huggingface.co provides the effect of clip-zero-shot-image-classification install, users can directly use clip-zero-shot-image-classification installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

clip-zero-shot-image-classification install url in huggingface.co:

https://huggingface.co/philschmid/clip-zero-shot-image-classification

Url of clip-zero-shot-image-classification

clip-zero-shot-image-classification huggingface.co Url

Provider of clip-zero-shot-image-classification huggingface.co

philschmid
ORGANIZATIONS

Other API from philschmid