Download resolution.py from andevs/bgremove: direct link, hf CLI and curl.
- Browser
- Download file 649 Bytes
-
https://huggingface.co/spaces/andevs/bgremove/resolve/main/resolution.py
- Command line
-
hf download hf://spaces/andevs/bgremove/resolution.py
-
curl -L -o resolution.py https://huggingface.co/spaces/andevs/bgremove/resolve/main/resolution.py
649 Bytes
| # resolution.py - Smart Resolution Management | |
| # FROZEN - DO NOT MODIFY | |
| class ResolutionManager: | |
| """Category-appropriate inference resolution - FROZEN.""" | |
| RECOMMENDED = { | |
| 'simple_graphic': 600, | |
| 'human_hair': 1024, | |
| 'human': 1024, | |
| 'anime': 800, | |
| 'logo_icon': 600, | |
| 'product_white_bg': 700, | |
| 'general_photo': 1024, | |
| 'complex': 1024 | |
| } | |
| def get_resolution(cls, category: str, original_size: tuple) -> int: | |
| base = cls.RECOMMENDED.get(category, 1024) | |
| if max(original_size) < base: | |
| return max(original_size) | |
| return base |