Ellie Sleightholm commited on
Commit
2a4d097
1 Parent(s): 8e62182

updating item list

Browse files
Files changed (1) hide show
  1. app.py +45 -56
app.py CHANGED
@@ -37,71 +37,60 @@ year = {2024}
37
 
38
  # List of fashion items
39
  items = [
40
- "leggings", "jogger", "palazzo", "cargo", "dresspants", "chinos",
41
- "dress", "blouse", "t-shirt", "jeans", "skirt", "shorts",
42
- "sweater", "cardigan", "tank top", "hoodie", "coat",
43
- "jacket", "polo shirt", "crop top", "romper",
44
- "overalls", "blazer", "sweatpants", "vest",
45
- "dungarees", "poncho", "bodysuit", "maxi dress",
46
- "hat", "sunglasses", "glasses", "shoes", "sandals", "heels", "trainers", "belt", "tie", "dress shirt", "boots",
47
- "slippers",
48
- "sneakers",
49
- "insoles",
50
- "socks",
51
- "insulated jacket",
52
- "fleece",
53
- "rain jacket",
54
- "running jacket",
55
- "windbreaker",
56
- "shirt",
57
- "t-shirt",
58
- "tank top",
59
- "graphic top",
60
- "sweater",
61
- "sweatshirt",
62
- "vest",
63
- "pant",
64
- "legging",
65
- "short",
66
- "dress",
67
- "skirt",
68
- "skort",
69
- "brief",
70
- "sports bra",
71
- "base layer top",
72
- "base layer bottom",
73
- "swimsuit",
74
- "rashguard",
75
- "water shorts",
76
- "cover up",
77
- "goggle",
78
- "hat",
79
- "sun hat",
80
- "glove",
81
- "mitten",
82
- "belt",
83
- "leg gaiter",
84
  ]
85
 
 
86
  # Initialize the model and tokenizer
87
  model_name = 'hf-hub:Marqo/marqo-fashionSigLIP'
88
  model, preprocess_train, preprocess_val = open_clip.create_model_and_transforms(model_name)
89
  tokenizer = open_clip.get_tokenizer(model_name)
90
 
91
- # Generate descriptions dynamically
92
  def generate_description(item):
93
- if "pants" in item or item in ["leggings", "jogger", "cargo", "chinos", "palazzo"]:
94
- return f"a pair of {item} pants"
95
- elif item in ["dress", "blouse", "t-shirt", "tank top", "sweater", "cardigan", "hoodie", "coat", "jacket", "polo shirt", "crop top", "romper", "blazer", "vest", "bodysuit", "maxi dress"]:
96
- return f"a {item}"
97
- elif item in ["hat", "sunglasses", "glasses"]:
98
- return f"a {item} worn on the head or face"
99
- elif item in ["shoes", "sandals", "heels", "trainers"]:
100
- return f"a pair of {item} worn on the feet"
101
- elif item in ["jeans", "skirt", "shorts", "sweatpants", "dungarees", "poncho", "overalls", "dress shirt"]:
102
- return f"a {item} piece of clothing"
 
 
103
  else:
104
- return f"a fashion item called {item}"
 
105
 
106
  items_desc = [generate_description(item) for item in items]
107
  text = tokenizer(items_desc)
 
37
 
38
  # List of fashion items
39
  items = [
40
+ "Leggings", "Jogger", "Palazzo", "Cargo", "Dresspants", "Chinos",
41
+ "Dress", "Blouse", "T-Shirt", "Jeans", "Skirt", "Shorts",
42
+ "Sweater", "Cardigan", "Tank Top", "Hoodie", "Coat",
43
+ "Jacket", "Polo Shirt", "Crop Top", "Romper",
44
+ "Overalls", "Blazer", "Sweatpants", "Vest",
45
+ "Dungarees", "Poncho", "Bodysuit", "Maxi Dress",
46
+ "Hat", "Sunglasses", "Glasses", "Shoes", "Sandals",
47
+ "Heels", "Trainers", "Belt", "Tie", "Dress Shirt",
48
+ "Boots", "Slippers", "Sneakers", "Insoles", "Socks",
49
+ "Insulated Jacket", "Fleece", "Rain Jacket", "Running Jacket",
50
+ "Windbreaker", "Shirt", "Graphic Top", "Sweatshirt",
51
+ "Pant", "Legging", "Short", "Skort", "Brief",
52
+ "Sports Bra", "Base Layer Top", "Base Layer Bottom",
53
+ "Swimsuit", "Rashguard", "Water Shorts", "Cover Up",
54
+ "Goggle", "Sun Hat", "Glove", "Mitten", "Leg Gaiter",
55
+ "Bandana", "Neck Gaiter", "Balaclava", "Sunglass",
56
+ "Watch", "Bag", "Boxer", "Swim Trunk", "Ring",
57
+ "Necklace", "Earing", "Pocket Watch", "Smock",
58
+ "Trouser", "Tuxedo", "Cufflinks", "Suspenders",
59
+ "Handkerchief", "Scarf", "Wristband", "Beanie",
60
+ "Fedora", "Beret", "Clutch Bag", "Crossbody Bag",
61
+ "Duffel Bag", "Backpack", "Umbrella", "Flip Flops",
62
+ "Espadrilles", "Loafers", "Moccasins", "Chelsea Boots",
63
+ "Ankle Boots", "Bow Tie", "Tie Clip", "Hair Clip",
64
+ "Headband", "Visor", "Baseball Cap", "Bucket Hat",
65
+ "Fingerless Gloves", "Touchscreen Gloves", "Trench Coat",
66
+ "Peacoat", "Parka", "Bomber Jacket", "Utility Vest",
67
+ "Puffer Jacket", "Cape", "Shrug", "Kimono", "Sarong",
68
+ "Apron", "Bikini", "Poncho", "Wristwatch", "Choker",
69
+ "Brooch", "Anklet", "Toe Ring", "Waist Belt"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  ]
71
 
72
+
73
  # Initialize the model and tokenizer
74
  model_name = 'hf-hub:Marqo/marqo-fashionSigLIP'
75
  model, preprocess_train, preprocess_val = open_clip.create_model_and_transforms(model_name)
76
  tokenizer = open_clip.get_tokenizer(model_name)
77
 
 
78
  def generate_description(item):
79
+ if "Pants" in item or item in ["Leggings", "Jogger", "Cargo", "Chinos", "Palazzo", "Dresspants", "Sweatpants", "Pant", "Legging", "Skort", "Trouser"]:
80
+ return f"A pair of {item} pants"
81
+ elif item in ["Dress", "Blouse", "T-Shirt", "Tank Top", "Sweater", "Cardigan", "Hoodie", "Coat", "Jacket", "Polo Shirt", "Crop Top", "Romper", "Blazer", "Vest", "Bodysuit", "Maxi Dress", "Graphic Top", "Shirt", "Base Layer Top", "Base Layer Bottom", "Swimsuit", "Rashguard", "Cover Up", "Smock", "Tuxedo"]:
82
+ return f"A {item}"
83
+ elif item in ["Hat", "Sunglasses", "Glasses", "Sun Hat", "Goggle", "Balaclava"]:
84
+ return f"A {item} worn on the head or face"
85
+ elif item in ["Shoes", "Sandals", "Heels", "Trainers", "Boots", "Slippers", "Sneakers", "Insoles", "Socks"]:
86
+ return f"A pair of {item} worn on the feet"
87
+ elif item in ["Jeans", "Skirt", "Shorts", "Dungarees", "Poncho", "Overalls", "Brief", "Boxer", "Swim Trunk", "Ring", "Necklace", "Earing", "Pocket Watch"]:
88
+ return f"A {item} piece of clothing"
89
+ elif item in ["Boxing Gloves", "Glove", "Mitten"]:
90
+ return f"An item of {item} worn on the hands"
91
  else:
92
+ return f"A fashion item called {item}"
93
+
94
 
95
  items_desc = [generate_description(item) for item in items]
96
  text = tokenizer(items_desc)