Create resolution.py
Browse files- resolution.py +23 -0
resolution.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# resolution.py - Smart Resolution Management
|
| 2 |
+
# FROZEN - DO NOT MODIFY
|
| 3 |
+
|
| 4 |
+
class ResolutionManager:
|
| 5 |
+
"""Category-appropriate inference resolution - FROZEN."""
|
| 6 |
+
|
| 7 |
+
RECOMMENDED = {
|
| 8 |
+
'simple_graphic': 600,
|
| 9 |
+
'human_hair': 1024,
|
| 10 |
+
'human': 1024,
|
| 11 |
+
'anime': 800,
|
| 12 |
+
'logo_icon': 600,
|
| 13 |
+
'product_white_bg': 700,
|
| 14 |
+
'general_photo': 1024,
|
| 15 |
+
'complex': 1024
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
@classmethod
|
| 19 |
+
def get_resolution(cls, category: str, original_size: tuple) -> int:
|
| 20 |
+
base = cls.RECOMMENDED.get(category, 1024)
|
| 21 |
+
if max(original_size) < base:
|
| 22 |
+
return max(original_size)
|
| 23 |
+
return base
|