Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,8 +10,7 @@ import colorsys
|
|
| 10 |
learn = load_learner('fashion_mnist_resnet18.pkl')
|
| 11 |
|
| 12 |
# Define class names
|
| 13 |
-
class_names = ['
|
| 14 |
-
'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot']
|
| 15 |
|
| 16 |
# Helper function to get the name of the closest color
|
| 17 |
def closest_color(requested_color):
|
|
@@ -41,18 +40,12 @@ def get_complementary_color(rgb_color):
|
|
| 41 |
return closest_color((r, g, b))
|
| 42 |
|
| 43 |
def get_outfit_recommendation(pred_class):
|
| 44 |
-
if pred_class in ['
|
| 45 |
-
return '
|
| 46 |
-
elif pred_class
|
| 47 |
-
return '
|
| 48 |
-
elif pred_class in ['Dress', 'Coat']:
|
| 49 |
-
return 'Shoes'
|
| 50 |
-
elif pred_class in ['Sandal', 'Sneaker', 'Ankle boot']:
|
| 51 |
-
return 'Trousers'
|
| 52 |
-
elif pred_class == 'Bag':
|
| 53 |
-
return 'Top'
|
| 54 |
else:
|
| 55 |
-
return '
|
| 56 |
|
| 57 |
def predict(image):
|
| 58 |
pred_class, pred_idx, outputs = learn.predict(image)
|
|
|
|
| 10 |
learn = load_learner('fashion_mnist_resnet18.pkl')
|
| 11 |
|
| 12 |
# Define class names
|
| 13 |
+
class_names = ['jeans', 'top']
|
|
|
|
| 14 |
|
| 15 |
# Helper function to get the name of the closest color
|
| 16 |
def closest_color(requested_color):
|
|
|
|
| 40 |
return closest_color((r, g, b))
|
| 41 |
|
| 42 |
def get_outfit_recommendation(pred_class):
|
| 43 |
+
if pred_class in ['jeans']:
|
| 44 |
+
return 'top'
|
| 45 |
+
elif pred_class in ['top']:
|
| 46 |
+
return 'top'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
else:
|
| 48 |
+
return 'item'
|
| 49 |
|
| 50 |
def predict(image):
|
| 51 |
pred_class, pred_idx, outputs = learn.predict(image)
|