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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -42,7 +42,7 @@ def get_complementary_color(rgb_color):
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
@@ -55,7 +55,7 @@ def get_monochromatic_palette(color_name, num_shades=3):
55
  for i in range(1, num_shades):
56
  hsv_colors.append((hsv_color[0], hsv_color[1], hsv_color[2] * (1 - 0.2 * i)))
57
  hex_palette = [mcolors.rgb2hex(colorsys.hsv_to_rgb(*hsv)) for hsv in hsv_colors]
58
- named_palette = [mcolors.CSS4_COLORS.get(hex_color, hex_color) for hex_color in hex_palette]
59
 
60
  return named_palette
61
 
@@ -74,7 +74,7 @@ def predict(image):
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
 
@@ -91,4 +91,4 @@ interface = gr.Interface(
91
  description="Upload an image of jeans or a top to get a recommendation for a complementary outfit based on fashion theory."
92
  )
93
 
94
- interface.launch()
 
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
 
55
  for i in range(1, num_shades):
56
  hsv_colors.append((hsv_color[0], hsv_color[1], hsv_color[2] * (1 - 0.2 * i)))
57
  hex_palette = [mcolors.rgb2hex(colorsys.hsv_to_rgb(*hsv)) for hsv in hsv_colors]
58
+ named_palette = [closest_color(mcolors.hex2color(hex_color)) for hex_color in hex_palette]
59
 
60
  return named_palette
61
 
 
74
  garment_recommendation = get_outfit_recommendation(pred_class)
75
 
76
  # Construct output string
77
+ output = f"For your {pred_class}, consider pairing it with a {garment_recommendation.lower()} in {complementary_color}, {', '.join(complementary_palette)}"
78
 
79
  return output # Return the formatted output
80
 
 
91
  description="Upload an image of jeans or a top to get a recommendation for a complementary outfit based on fashion theory."
92
  )
93
 
94
+ interface.launch()