Skip to main content

🤗 Simple Aesthetics Predictor

CI Release Python PyPI

CLIP-based aesthetics predictor inspired by the interface of 🤗 huggingface transformers. This library provides a simple wrapper that can load the predictor using the from_pretrained method.

Install

pip install simple-aesthetics-predictor

How to Use

import requests
import torch
from PIL import Image
from transformers import CLIPProcessor

from aesthetics_predictor import AestheticsPredictorV1

#
# Load the aesthetics predictor
#
model_id = "shunk031/aesthetics-predictor-v1-vit-large-patch14"

model = AestheticsPredictorV1.from_pretrained(model_id)
processor = CLIPProcessor.from_pretrained(model_id)

#
# Download sample image
#
url = "https://github.com/shunk031/simple-aesthetics-predictor/blob/master/assets/a-photo-of-an-astronaut-riding-a-horse.png?raw=true"
image = Image.open(requests.get(url, stream=True).raw)

#
# Preprocess the image
#
inputs = processor(images=image, return_tensor="pt")

#
# Inference for the image
#
with torch.no_grad():
    outputs = model(**inputs)
prediction = outputs.logits

print(f"Aesthetics score: {prediction}")

The Predictors found in 🤗 Huggingface Hub

Acknowledgements

Release files for simple-aesthetics-predictor 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-aesthetics-predictor 0.1.2
File Size Uploaded
simple_aesthetics_predictor-0.1.2.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-aesthetics-predictor 0.1.2
File Interpreter ABI Platform
simple_aesthetics_predictor-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.9 kB

Release files / simple_aesthetics_predictor-0.1.2.tar.gz

Download URL simple_aesthetics_predictor-0.1.2.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7d992ffd643be35ee56d540f9bc4d6e54f3734d995fc145a17996d018b18cec3
BLAKE2b-256 checksum
How to use checksums
3abbceb460fadfbe100909bbfa81f30893fe684202db07fe95e7b163241cf408
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure

Release files / simple_aesthetics_predictor-0.1.2-py3-none-any.whl

Download URL simple_aesthetics_predictor-0.1.2-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d624abbea19118ab51b613f14bb608b0b811d42fb1240ae2a9224a676c1bf262
BLAKE2b-256 checksum
How to use checksums
8892c4805e510862a5ddb7d34370ccd818e09a950c23500294a2d3a7b33efecb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.4 Linux/5.15.0-1041-azure

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page