Name | simple-aesthetics-predictor JSON |
Version |
0.1.2
JSON |
| download |
home_page | |
Summary | |
upload_time | 2023-07-22 08:59:43 |
maintainer | |
docs_url | None |
author | Shunsuke KITADA |
requires_python | >=3.8,<4.0 |
license | |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 🤗 Simple Aesthetics Predictor
[](https://github.com/shunk031/simple-aesthetics-predictor/actions/workflows/ci.yaml)
[](https://github.com/shunk031/simple-aesthetics-predictor/actions/workflows/deploy_and_release.yaml)

[](https://pypi.python.org/pypi/simple-aesthetics-predictor)
[CLIP](https://arxiv.org/abs/2103.00020)-based aesthetics predictor inspired by the interface of [🤗 huggingface transformers](https://huggingface.co/docs/transformers/index). This library provides a simple wrapper that can load the predictor using the `from_pretrained` method.
## Install
```shell
pip install simple-aesthetics-predictor
```
## How to Use
```python
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
- 🤗 [aesthetics-predictor-v1](https://huggingface.co/models?search=aesthetics-predictor-v1)
- 🤗 [aesthetics-predictor-v2](https://huggingface.co/models?search=aesthetics-predictor-v2)
## 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
Raw data
{
"_id": null,
"home_page": "",
"name": "simple-aesthetics-predictor",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Shunsuke KITADA",
"author_email": "shunsuke.kitada.0831@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/3a/bb/ceb460fadfbe100909bbfa81f30893fe684202db07fe95e7b163241cf408/simple_aesthetics_predictor-0.1.2.tar.gz",
"platform": null,
"description": "# \ud83e\udd17 Simple Aesthetics Predictor\n\n[](https://github.com/shunk031/simple-aesthetics-predictor/actions/workflows/ci.yaml)\n[](https://github.com/shunk031/simple-aesthetics-predictor/actions/workflows/deploy_and_release.yaml)\n\n[](https://pypi.python.org/pypi/simple-aesthetics-predictor)\n\n[CLIP](https://arxiv.org/abs/2103.00020)-based aesthetics predictor inspired by the interface of [\ud83e\udd17 huggingface transformers](https://huggingface.co/docs/transformers/index). This library provides a simple wrapper that can load the predictor using the `from_pretrained` method.\n\n## Install\n\n```shell\npip install simple-aesthetics-predictor\n```\n\n## How to Use\n\n```python\nimport requests\nimport torch\nfrom PIL import Image\nfrom transformers import CLIPProcessor\n\nfrom aesthetics_predictor import AestheticsPredictorV1\n\n#\n# Load the aesthetics predictor\n#\nmodel_id = \"shunk031/aesthetics-predictor-v1-vit-large-patch14\"\n\nmodel = AestheticsPredictorV1.from_pretrained(model_id)\nprocessor = CLIPProcessor.from_pretrained(model_id)\n\n#\n# Download sample image\n#\nurl = \"https://github.com/shunk031/simple-aesthetics-predictor/blob/master/assets/a-photo-of-an-astronaut-riding-a-horse.png?raw=true\"\nimage = Image.open(requests.get(url, stream=True).raw)\n\n#\n# Preprocess the image\n#\ninputs = processor(images=image, return_tensor=\"pt\")\n\n#\n# Inference for the image\n#\nwith torch.no_grad():\n outputs = model(**inputs)\nprediction = outputs.logits\n\nprint(f\"Aesthetics score: {prediction}\")\n```\n\n## The Predictors found in \ud83e\udd17 Huggingface Hub\n\n- \ud83e\udd17 [aesthetics-predictor-v1](https://huggingface.co/models?search=aesthetics-predictor-v1)\n- \ud83e\udd17 [aesthetics-predictor-v2](https://huggingface.co/models?search=aesthetics-predictor-v2)\n\n## Acknowledgements\n\n- 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 \n- christophschuhmann/improved-aesthetic-predictor: CLIP+MLP Aesthetic Score Predictor https://github.com/christophschuhmann/improved-aesthetic-predictor \n",
"bugtrack_url": null,
"license": "",
"summary": "",
"version": "0.1.2",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8892c4805e510862a5ddb7d34370ccd818e09a950c23500294a2d3a7b33efecb",
"md5": "fa9d26d4d67d1d12415804b119799eb6",
"sha256": "d624abbea19118ab51b613f14bb608b0b811d42fb1240ae2a9224a676c1bf262"
},
"downloads": -1,
"filename": "simple_aesthetics_predictor-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fa9d26d4d67d1d12415804b119799eb6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 5847,
"upload_time": "2023-07-22T08:59:43",
"upload_time_iso_8601": "2023-07-22T08:59:43.041734Z",
"url": "https://files.pythonhosted.org/packages/88/92/c4805e510862a5ddb7d34370ccd818e09a950c23500294a2d3a7b33efecb/simple_aesthetics_predictor-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3abbceb460fadfbe100909bbfa81f30893fe684202db07fe95e7b163241cf408",
"md5": "a2b2949e5a9b143bfafa72a7cf8eecf1",
"sha256": "7d992ffd643be35ee56d540f9bc4d6e54f3734d995fc145a17996d018b18cec3"
},
"downloads": -1,
"filename": "simple_aesthetics_predictor-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "a2b2949e5a9b143bfafa72a7cf8eecf1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 4047,
"upload_time": "2023-07-22T08:59:43",
"upload_time_iso_8601": "2023-07-22T08:59:43.935669Z",
"url": "https://files.pythonhosted.org/packages/3a/bb/ceb460fadfbe100909bbfa81f30893fe684202db07fe95e7b163241cf408/simple_aesthetics_predictor-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-22 08:59:43",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "simple-aesthetics-predictor"
}