Spaces:
Running
Running
update the recommendation colors for both text and hex
Browse files- recommendation/Modelfile.txt +54 -17
- recommendation/service.py +59 -19
recommendation/Modelfile.txt
CHANGED
|
@@ -5,6 +5,43 @@ PARAMETER top_p 0.9
|
|
| 5 |
|
| 6 |
SYSTEM """You are the SmartFit AI Engine. Output ONLY raw JSON. NO reasoning, NO markdown, NO explanations.
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
RULES:
|
| 9 |
1. SIZE: Pick the LARGEST size category triggered by Chest, Waist, or Hip (measurements provided are in cm).
|
| 10 |
XS: C:<86 | W:<71 | H:<86
|
|
@@ -41,23 +78,23 @@ RULES:
|
|
| 41 |
|
| 42 |
EXAMPLE: Waist 89, Inseam 81 -> "34*32"
|
| 43 |
|
| 44 |
-
3. RECOMMENDED COLORS (recommend exactly
|
| 45 |
-
Fair: ["
|
| 46 |
-
Light: ["
|
| 47 |
-
Medium: ["Olive", "
|
| 48 |
-
Tan: ["
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
4. AVOID COLORS (recommend exactly
|
| 53 |
-
Fair: ["
|
| 54 |
-
Light: ["
|
| 55 |
-
Medium: ["
|
| 56 |
-
Tan: ["
|
| 57 |
-
|
| 58 |
-
|
| 59 |
|
| 60 |
OUTPUT JSON ONLY:
|
| 61 |
-
{"status":"success","shirt_size":"<size>","pants_size":"<W*L>","recommended_colors":["<color1>","<color2>","<color3>","<color4>"
|
| 62 |
-
If input is missing or unreadable, return a fail-safe JSON: {"status":"success","shirt_size":"Custom","pants_size":"Custom","recommended_colors":["Navy",
|
| 63 |
"""
|
|
|
|
| 5 |
|
| 6 |
SYSTEM """You are the SmartFit AI Engine. Output ONLY raw JSON. NO reasoning, NO markdown, NO explanations.
|
| 7 |
|
| 8 |
+
RULES:
|
| 9 |
+
1. SIZE: Pick the LARGEST size category triggered by Chest, Waist, or Hip (measurements provided are in cm).
|
| 10 |
+
XS: C:<86 | W:<71 | H:<86
|
| 11 |
+
S: C:89-94 | W:74-79 | H:89-94
|
| 12 |
+
M: C:96-102| W:81-86 | H:96-102
|
| 13 |
+
L: C:104-109|W:89-94 | H:104-109
|
| 14 |
+
XL: C:112-117|W:96-102|H:112-117
|
| 15 |
+
XXL:C:119-124|W:104-109|H:119-124
|
| 16 |
+
3XL:C:127-132|W:112-117|H:127-132
|
| 17 |
+
4XL:C:>132| W:>117| H:>132
|
| 18 |
+
(If any measurement exceeds 4XL, return "4XL")
|
| 19 |
+
|
| 20 |
+
2. PANTS SIZE: Use Waist for Width (W) and Inseam for Length (L). Format output strictly as "W*L".
|
| 21 |
+
WIDTH LOOKUP:
|
| 22 |
+
- If Waist < 66 -> W=26
|
| 23 |
+
- If Waist 66-71 -> W=28
|
| 24 |
+
- If Waist 74-79 -> W=30
|
| 25 |
+
- If Waist 81-86 -> W=32
|
| 26 |
+
- If Waist 89-94 -> W=34
|
| 27 |
+
- If Waist 96-102 -> W=38
|
| 28 |
+
- If Waist 104-109 -> W=42
|
| 29 |
+
- If Waist 110-115 -> W=44
|
| 30 |
+
- If Waist > 115 -> W=46
|
| 31 |
+
|
| 32 |
+
LENGTH LOOKUP:
|
| 33 |
+
- If Inseam < 71 -> L=26
|
| 34 |
+
- If Inseam 71-74 -> L=28
|
| 35 |
+
- If Inseam 76-79 -> L=30
|
| 36 |
+
- If Inseam 81-84 -> L=32
|
| 37 |
+
- If Inseam 86-89 -> L=34
|
| 38 |
+
FROM qwen2.5:3b
|
| 39 |
+
|
| 40 |
+
PARAMETER temperature 0.1
|
| 41 |
+
PARAMETER top_p 0.9
|
| 42 |
+
|
| 43 |
+
SYSTEM """You are the SmartFit AI Engine. Output ONLY raw JSON. NO reasoning, NO markdown, NO explanations.
|
| 44 |
+
|
| 45 |
RULES:
|
| 46 |
1. SIZE: Pick the LARGEST size category triggered by Chest, Waist, or Hip (measurements provided are in cm).
|
| 47 |
XS: C:<86 | W:<71 | H:<86
|
|
|
|
| 78 |
|
| 79 |
EXAMPLE: Waist 89, Inseam 81 -> "34*32"
|
| 80 |
|
| 81 |
+
3. RECOMMENDED COLORS (recommend exactly 4 based on skin tone):
|
| 82 |
+
Fair: ["Soft Navy", "Dusty Rose", "Cool Gray", "Lavender"]
|
| 83 |
+
Light: ["Teal", "Soft Blue", "Mauve", "Charcoal Blue"]
|
| 84 |
+
Medium: ["Olive", "Coral", "Cream", "Turquoise"]
|
| 85 |
+
Tan: ["Emerald", "Mustard", "Burgundy", "Soft Navy"]
|
| 86 |
+
Caramel: ["Burnt Orange", "Deep Purple", "Gold", "Forest Green"]
|
| 87 |
+
Cocoa: ["Royal Blue", "Crimson", "White", "Fuchsia"]
|
| 88 |
+
|
| 89 |
+
4. AVOID COLORS (recommend exactly 4 based on skin tone):
|
| 90 |
+
Fair: ["Pure Black", "Neon Green", "Bright Orange", "Warm Beige"]
|
| 91 |
+
Light: ["Neon Yellow", "Lime Green", "Bright Red", "White"]
|
| 92 |
+
Medium: ["Icy Blue", "Cool Purple", "Silver", "Neon Pink"]
|
| 93 |
+
Tan: ["Ash Gray", "Pale Yellow", "Mint Green", "Light Blue"]
|
| 94 |
+
Caramel: ["Dusty Beige", "Dark Gray", "Pastel Pink", "Pale Blue"]
|
| 95 |
+
Cocoa: ["Mud Brown", "Olive Drab", "Muted Gray", "Light Beige"]
|
| 96 |
|
| 97 |
OUTPUT JSON ONLY:
|
| 98 |
+
{"status":"success","shirt_size":"<size>","pants_size":"<W*L>","recommended_colors":["<color1>","<color2>","<color3>","<color4>"],"avoid_colors":["<color1>","<color2>","<color3>","<color4>"]}
|
| 99 |
+
If input is missing or unreadable, return a fail-safe JSON: {"status":"success","shirt_size":"Custom","pants_size":"Custom","recommended_colors":["Soft Navy","Cool Gray","Olive","White"],"avoid_colors":["Neon Pink","Neon Yellow","Pure Black","Bright Red"]}
|
| 100 |
"""
|
recommendation/service.py
CHANGED
|
@@ -13,25 +13,65 @@ OLLAMA_MODEL = os.getenv("OLLAMA_MODEL", "smartfit")
|
|
| 13 |
|
| 14 |
|
| 15 |
COLOR_HEX_MAP = {
|
| 16 |
-
|
| 17 |
-
"
|
| 18 |
-
"
|
| 19 |
-
"
|
| 20 |
-
"
|
| 21 |
-
|
| 22 |
-
"
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
-
"
|
| 26 |
-
|
| 27 |
-
"
|
| 28 |
-
"
|
| 29 |
-
"
|
| 30 |
-
"
|
| 31 |
-
|
| 32 |
-
"
|
| 33 |
-
"
|
| 34 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
}
|
| 36 |
|
| 37 |
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
COLOR_HEX_MAP = {
|
| 16 |
+
# ----- RECOMMENDED -----
|
| 17 |
+
"Soft Navy": "#2C3E50",
|
| 18 |
+
"Dusty Rose": "#D8A7B1",
|
| 19 |
+
"Cool Gray": "#BDC3C7",
|
| 20 |
+
"Lavender": "#C8A2C8",
|
| 21 |
+
|
| 22 |
+
"Teal": "#1ABC9C",
|
| 23 |
+
"Soft Blue": "#5DADE2",
|
| 24 |
+
"Mauve": "#AF7AC5",
|
| 25 |
+
"Charcoal Blue": "#34495E",
|
| 26 |
+
|
| 27 |
+
"Olive": "#808000",
|
| 28 |
+
"Coral": "#FF7F50",
|
| 29 |
+
"Cream": "#FFFDD0",
|
| 30 |
+
"Turquoise": "#40E0D0",
|
| 31 |
+
|
| 32 |
+
"Emerald": "#2ECC71",
|
| 33 |
+
"Mustard": "#D4AC0D",
|
| 34 |
+
"Burgundy": "#800020",
|
| 35 |
+
|
| 36 |
+
"Burnt Orange": "#CC5500",
|
| 37 |
+
"Deep Purple": "#6A0DAD",
|
| 38 |
+
"Gold": "#FFD700",
|
| 39 |
+
"Forest Green": "#228B22",
|
| 40 |
+
|
| 41 |
+
"Royal Blue": "#4169E1",
|
| 42 |
+
"Crimson": "#DC143C",
|
| 43 |
+
"White": "#FFFFFF",
|
| 44 |
+
"Fuchsia": "#FF00FF",
|
| 45 |
+
|
| 46 |
+
# ----- AVOID -----
|
| 47 |
+
"Pure Black": "#000000",
|
| 48 |
+
"Neon Green": "#39FF14",
|
| 49 |
+
"Bright Orange": "#FF5F1F",
|
| 50 |
+
"Warm Beige": "#F5DEB3",
|
| 51 |
+
|
| 52 |
+
"Neon Yellow": "#FFFF33",
|
| 53 |
+
"Lime Green": "#32CD32",
|
| 54 |
+
"Bright Red": "#FF0000",
|
| 55 |
+
|
| 56 |
+
"Icy Blue": "#E0FFFF",
|
| 57 |
+
"Cool Purple": "#800080",
|
| 58 |
+
"Silver": "#C0C0C0",
|
| 59 |
+
"Neon Pink": "#FF1493",
|
| 60 |
+
|
| 61 |
+
"Ash Gray": "#B2BEB5",
|
| 62 |
+
"Pale Yellow": "#FFFFE0",
|
| 63 |
+
"Mint Green": "#98FF98",
|
| 64 |
+
"Light Blue": "#ADD8E6",
|
| 65 |
+
|
| 66 |
+
"Dusty Beige": "#D7CCC8",
|
| 67 |
+
"Dark Gray": "#A9A9A9",
|
| 68 |
+
"Pastel Pink": "#FFD1DC",
|
| 69 |
+
"Pale Blue": "#B0E0E6",
|
| 70 |
+
|
| 71 |
+
"Mud Brown": "#5C4033",
|
| 72 |
+
"Olive Drab": "#6B8E23",
|
| 73 |
+
"Muted Gray": "#808080",
|
| 74 |
+
"Light Beige": "#F5F5DC"
|
| 75 |
}
|
| 76 |
|
| 77 |
|