Skip to content

chitradrishti/adlike

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Detect Advertisement Images

Usage


pip install adlike
import requests
from PIL import Image

from adlike import ad_openai_clip_vitl_patch14_336

device = "cuda" if torch.cuda.is_available() else "cpu"
model, preprocess = ad_openai_clip_vitl_patch14_336()

url = "https://literacyideas.com/wp-content/uploads/2021/08/christmas_advertising.jpg"
image = Image.open(requests.get(url, stream=True).raw)


with torch.no_grad():
    image = preprocess(img).to(device).unsqueeze(0)
    probs = model(image)

print("Label probs:", probs)  # prints: tensor([[0.9753]])

About

Predict to what extent an Image is an Advertisement.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages