prithivMLmods commited on
Commit
998f30e
·
verified ·
1 Parent(s): 57964c2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +77 -1
README.md CHANGED
@@ -2,6 +2,10 @@
2
  license: apache-2.0
3
  ---
4
 
 
 
 
 
5
  ```py
6
  Classification Report:
7
  precision recall f1-score support
@@ -14,4 +18,76 @@ Classification Report:
14
  accuracy 0.7121 44072
15
  macro avg 0.7742 0.6965 0.7289 44072
16
  weighted avg 0.7174 0.7121 0.7103 44072
17
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: apache-2.0
3
  ---
4
 
5
+ # **Fashion-Product-Season**
6
+
7
+ > **Fashion-Product-Season** is a vision-language model fine-tuned from **google/siglip2-base-patch16-224** using the **SiglipForImageClassification** architecture. It classifies fashion product images based on their suitable **season of use**.
8
+
9
  ```py
10
  Classification Report:
11
  precision recall f1-score support
 
18
  accuracy 0.7121 44072
19
  macro avg 0.7742 0.6965 0.7289 44072
20
  weighted avg 0.7174 0.7121 0.7103 44072
21
+ ```
22
+ The model predicts one of the following **season categories**:
23
+
24
+ - **0:** Fall
25
+ - **1:** Spring
26
+ - **2:** Summer
27
+ - **3:** Winter
28
+
29
+ ---
30
+
31
+ # **Run with Transformers 🤗**
32
+
33
+ ```python
34
+ !pip install -q transformers torch pillow gradio
35
+ ```
36
+
37
+ ```python
38
+ import gradio as gr
39
+ from transformers import AutoImageProcessor, SiglipForImageClassification
40
+ from PIL import Image
41
+ import torch
42
+
43
+ # Load model and processor
44
+ model_name = "prithivMLmods/Fashion-Product-Season" # Replace with your actual model path
45
+ model = SiglipForImageClassification.from_pretrained(model_name)
46
+ processor = AutoImageProcessor.from_pretrained(model_name)
47
+
48
+ # Label mapping
49
+ id2label = {
50
+ 0: "Fall",
51
+ 1: "Spring",
52
+ 2: "Summer",
53
+ 3: "Winter"
54
+ }
55
+
56
+ def classify_season(image):
57
+ """Predicts the most suitable season for a fashion product."""
58
+ image = Image.fromarray(image).convert("RGB")
59
+ inputs = processor(images=image, return_tensors="pt")
60
+
61
+ with torch.no_grad():
62
+ outputs = model(**inputs)
63
+ logits = outputs.logits
64
+ probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
65
+
66
+ predictions = {id2label[i]: round(probs[i], 3) for i in range(len(probs))}
67
+ predictions = dict(sorted(predictions.items(), key=lambda item: item[1], reverse=True))
68
+ return predictions
69
+
70
+ # Gradio interface
71
+ iface = gr.Interface(
72
+ fn=classify_season,
73
+ inputs=gr.Image(type="numpy"),
74
+ outputs=gr.Label(label="Season Prediction Scores"),
75
+ title="Fashion-Product-Season",
76
+ description="Upload a fashion product image to predict its most suitable season (Fall, Spring, Summer, Winter)."
77
+ )
78
+
79
+ # Launch the app
80
+ if __name__ == "__main__":
81
+ iface.launch()
82
+ ```
83
+
84
+ ---
85
+
86
+ # **Intended Use**
87
+
88
+ This model can be used for:
89
+
90
+ - **Seasonal tagging in fashion e-commerce**
91
+ - **Improved recommendations for seasonal shopping trends**
92
+ - **Inventory planning based on product seasonality**
93
+ - **Data labeling for fashion-specific recommendation engines**