🤗 Simple Aesthetics Predictor
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
- LAION-AI/aesthetic-predictor: A linear estimator on top of clip to predict the aesthetic quality of pictures https://github.com/LAION-AI/aesthetic-predictor
- christophschuhmann/improved-aesthetic-predictor: CLIP+MLP Aesthetic Score Predictor https://github.com/christophschuhmann/improved-aesthetic-predictor
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)
| File | Size | Uploaded | |
|---|---|---|---|
| simple_aesthetics_predictor-0.1.2.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|