Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,7 +43,6 @@ def get_complementary_color(rgb_color):
|
|
| 43 |
complementary_palette = get_monochromatic_palette(complementary_color)
|
| 44 |
|
| 45 |
return complementary_color, complementary_palette
|
| 46 |
-
|
| 47 |
|
| 48 |
def get_monochromatic_palette(color_name, num_shades=3):
|
| 49 |
rgb_color = mcolors.CSS4_COLORS[color_name]
|
|
@@ -53,7 +52,6 @@ def get_monochromatic_palette(color_name, num_shades=3):
|
|
| 53 |
hsv_colors.append((hsv_colors[-1][0], hsv_colors[-1][1], hsv_colors[-1][2] * (1 - 0.2 * i)))
|
| 54 |
return [mcolors.rgb2hex(colorsys.hsv_to_rgb(*hsv)) for hsv in hsv_colors]
|
| 55 |
|
| 56 |
-
|
| 57 |
def get_outfit_recommendation(pred_class):
|
| 58 |
if pred_class == 'top':
|
| 59 |
return 'Jeans'
|
|
@@ -75,6 +73,8 @@ def predict(image):
|
|
| 75 |
output += f" {color},"
|
| 76 |
output = output[:-1] # Removes the last comma
|
| 77 |
output += "."
|
|
|
|
|
|
|
| 78 |
|
| 79 |
def gradio_predict(image):
|
| 80 |
if isinstance(image, np.ndarray):
|
|
@@ -86,7 +86,7 @@ interface = gr.Interface(
|
|
| 86 |
inputs=gr.Image(),
|
| 87 |
outputs="text",
|
| 88 |
title="Outfit Recommender",
|
| 89 |
-
description="Upload an image of
|
| 90 |
)
|
| 91 |
|
| 92 |
interface.launch()
|
|
|
|
| 43 |
complementary_palette = get_monochromatic_palette(complementary_color)
|
| 44 |
|
| 45 |
return complementary_color, complementary_palette
|
|
|
|
| 46 |
|
| 47 |
def get_monochromatic_palette(color_name, num_shades=3):
|
| 48 |
rgb_color = mcolors.CSS4_COLORS[color_name]
|
|
|
|
| 52 |
hsv_colors.append((hsv_colors[-1][0], hsv_colors[-1][1], hsv_colors[-1][2] * (1 - 0.2 * i)))
|
| 53 |
return [mcolors.rgb2hex(colorsys.hsv_to_rgb(*hsv)) for hsv in hsv_colors]
|
| 54 |
|
|
|
|
| 55 |
def get_outfit_recommendation(pred_class):
|
| 56 |
if pred_class == 'top':
|
| 57 |
return 'Jeans'
|
|
|
|
| 73 |
output += f" {color},"
|
| 74 |
output = output[:-1] # Removes the last comma
|
| 75 |
output += "."
|
| 76 |
+
|
| 77 |
+
return output # Return the formatted output
|
| 78 |
|
| 79 |
def gradio_predict(image):
|
| 80 |
if isinstance(image, np.ndarray):
|
|
|
|
| 86 |
inputs=gr.Image(),
|
| 87 |
outputs="text",
|
| 88 |
title="Outfit Recommender",
|
| 89 |
+
description="Upload an image of jeans or a top to get a recommendation for a complementary outfit based on fashion theory."
|
| 90 |
)
|
| 91 |
|
| 92 |
interface.launch()
|