vaniv commited on
Commit
06dba96
·
verified ·
1 Parent(s): 1db4a30

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -38,9 +38,12 @@ def get_complementary_color(rgb_color):
38
  complementary_h = (h + 0.5) % 1.0
39
  r, g, b = colorsys.hsv_to_rgb(complementary_h, s, v)
40
  complementary_color = closest_color((r, g, b))
41
-
42
  # Get shades or tones of the complementary color
43
- complementary_palette = get_monochromatic_palette(complementary_color)
 
 
 
44
 
45
  return complementary_color, complementary_palette
46
 
@@ -71,14 +74,7 @@ def predict(image):
71
  garment_recommendation = get_outfit_recommendation(pred_class)
72
 
73
  # Construct output string
74
- output = f"For your {pred_class.lower()}, consider pairing with {garment_recommendation.lower()} in {complementary_color}."
75
-
76
- # Handle monochromatic options
77
- monochromatic_options = set(complementary_palette) # Use a set to avoid duplicates
78
- monochromatic_options.discard(complementary_color.lower()) # Remove the complementary color
79
-
80
- if len(monochromatic_options) > 0:
81
- output += f"\nMonochromatic options: {', '.join(monochromatic_options)}."
82
 
83
  return output # Return the formatted output
84
 
 
38
  complementary_h = (h + 0.5) % 1.0
39
  r, g, b = colorsys.hsv_to_rgb(complementary_h, s, v)
40
  complementary_color = closest_color((r, g, b))
41
+ complementary_palette = []
42
  # Get shades or tones of the complementary color
43
+ complementary_colors = get_monochromatic_palette(complementary_color)
44
+ for color in complementary_colors:
45
+ if closest_color(color)!=complementary_color:
46
+ complementary_palette.append(closest_color(color))
47
 
48
  return complementary_color, complementary_palette
49
 
 
74
  garment_recommendation = get_outfit_recommendation(pred_class)
75
 
76
  # Construct output string
77
+ output = f"For your {pred_class.lower()}, consider pairing with {garment_recommendation.lower()} in {complementary_color}, {complementary_palette}."
 
 
 
 
 
 
 
78
 
79
  return output # Return the formatted output
80