
![tregsd.png](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/f-YpJJbkFilf4Q2gJA9SM.png)

# **Fashion-Product-Season**

> **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**.

```py
Classification Report:
              precision    recall  f1-score   support

        Fall     0.6173    0.5655    0.5903     11414
      Spring     0.9738    0.7665    0.8578      2711
      Summer     0.7051    0.8107    0.7542     21438
      Winter     0.8007    0.6432    0.7134      8509

    accuracy                         0.7121     44072
   macro avg     0.7742    0.6965    0.7289     44072
weighted avg     0.7174    0.7121    0.7103     44072
```
The model predicts one of the following **season categories**:

- **0:** Fall  
- **1:** Spring  
- **2:** Summer  
- **3:** Winter

---

# **Run with Transformers 🤗**

```python
!pip install -q transformers torch pillow gradio
```

```python
import gradio as gr
from transformers import AutoImageProcessor, SiglipForImageClassification
from PIL import Image
import torch

# Load model and processor
model_name = "prithivMLmods/Fashion-Product-Season"  # Replace with your actual model path
model = SiglipForImageClassification.from_pretrained(model_name)
processor = AutoImageProcessor.from_pretrained(model_name)

# Label mapping
id2label = {
    0: "Fall",
    1: "Spring",
    2: "Summer",
    3: "Winter"
}

def classify_season(image):
    """Predicts the most suitable season for a fashion product."""
    image = Image.fromarray(image).convert("RGB")
    inputs = processor(images=image, return_tensors="pt")

    with torch.no_grad():
        outputs = model(**inputs)
        logits = outputs.logits
        probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()

    predictions = {id2label[i]: round(probs[i], 3) for i in range(len(probs))}
    predictions = dict(sorted(predictions.items(), key=lambda item: item[1], reverse=True))
    return predictions

# Gradio interface
iface = gr.Interface(
    fn=classify_season,
    inputs=gr.Image(type="numpy"),
    outputs=gr.Label(label="Season Prediction Scores"),
    title="Fashion-Product-Season",
    description="Upload a fashion product image to predict its most suitable season (Fall, Spring, Summer, Winter)."
)

# Launch the app
if __name__ == "__main__":
    iface.launch()
```

---

# **Intended Use**

This model can be used for:

- **Seasonal tagging in fashion e-commerce**  
- **Improved recommendations for seasonal shopping trends**  
- **Inventory planning based on product seasonality**  
- **Data labeling for fashion-specific recommendation engines**
fall spring summer winter