{"id":19731508,"url":"https://github.com/shunk031/simple-aesthetics-predictor","last_synced_at":"2025-04-30T02:31:12.095Z","repository":{"id":178632921,"uuid":"662066116","full_name":"shunk031/simple-aesthetics-predictor","owner":"shunk031","description":"CLIP-based aesthetics predictor inspired by the interface of 🤗 huggingface transformers. ","archived":false,"fork":false,"pushed_at":"2024-06-14T11:20:24.000Z","size":545,"stargazers_count":36,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T03:29:34.610Z","etag":null,"topics":["aesthetic-predictor","clip","huggingface","huggingface-transformers","vit"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shunk031.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-04T09:29:42.000Z","updated_at":"2025-03-17T01:17:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"d36f116e-7cc2-456f-81e9-fc5dfda73d0d","html_url":"https://github.com/shunk031/simple-aesthetics-predictor","commit_stats":null,"previous_names":["shunk031/simple-aesthetics-predictor"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shunk031%2Fsimple-aesthetics-predictor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shunk031%2Fsimple-aesthetics-predictor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shunk031%2Fsimple-aesthetics-predictor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shunk031%2Fsimple-aesthetics-predictor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shunk031","download_url":"https://codeload.github.com/shunk031/simple-aesthetics-predictor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251629094,"owners_count":21618102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aesthetic-predictor","clip","huggingface","huggingface-transformers","vit"],"created_at":"2024-11-12T00:21:24.881Z","updated_at":"2025-04-30T02:31:11.673Z","avatar_url":"https://github.com/shunk031.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🤗 Simple Aesthetics Predictor\n\n[![CI](https://github.com/shunk031/simple-aesthetics-predictor/actions/workflows/ci.yaml/badge.svg)](https://github.com/shunk031/simple-aesthetics-predictor/actions/workflows/ci.yaml)\n[![Release](https://github.com/shunk031/simple-aesthetics-predictor/actions/workflows/release.yaml/badge.svg)](https://github.com/shunk031/simple-aesthetics-predictor/actions/workflows/release.yaml)\n[![Deploy](https://github.com/shunk031/simple-aesthetics-predictor/actions/workflows/deploy.yaml/badge.svg)](https://github.com/shunk031/simple-aesthetics-predictor/actions/workflows/deploy.yaml)\n![Python](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10-blue?logo=python)\n[![PyPI](https://img.shields.io/pypi/v/simple-aesthetics-predictor.svg)](https://pypi.python.org/pypi/simple-aesthetics-predictor)\n![Hugging Face Models Hub](https://img.shields.io/badge/Hugging%20Face_🤗-Models-ffcc66)\n\n[CLIP](https://arxiv.org/abs/2103.00020)-based aesthetics predictor inspired by the interface of [🤗 huggingface transformers](https://huggingface.co/docs/transformers/index).\nThis library provides a simple wrapper that can load the predictor using the `from_pretrained` method.\n\nWe currently provide the following wrappers for aesthetics predictor:\n- **v1**: 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- **v2**: christophschuhmann/improved-aesthetic-predictor: CLIP+MLP Aesthetic Score Predictor https://github.com/christophschuhmann/improved-aesthetic-predictor \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\npredictor = 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_tensors=\"pt\")\n\n#\n# Move to GPU\n#\ndevice = \"cuda\"\npredictor = predictor.to(device)\ninputs = {k: v.to(device) for k, v in inputs.items()}\n\n#\n# Inference for the image\n#\nwith torch.no_grad(): # or `torch.inference_model` in torch 1.9+\n    outputs = predictor(**inputs)\nprediction = outputs.logits\n\nprint(f\"Aesthetics score: {prediction}\")\n```\n\n## The Predictors found in 🤗 Huggingface Hub\n\n- 🤗 [aesthetics-predictor-v1](https://huggingface.co/models?search=aesthetics-predictor-v1)\n- 🤗 [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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshunk031%2Fsimple-aesthetics-predictor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshunk031%2Fsimple-aesthetics-predictor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshunk031%2Fsimple-aesthetics-predictor/lists"}