Views
No views yet

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.
1Classification Report:
2 precision recall f1-score support
3
4 Fall 0.6173 0.5655 0.5903 11414
5 Spring 0.9738 0.7665 0.8578 2711
6 Summer 0.7051 0.8107 0.7542 21438
7 Winter 0.8007 0.6432 0.7134 8509
8
9 accuracy 0.7121 44072
10 macro avg 0.7742 0.6965 0.7289 44072
11weighted avg 0.7174 0.7121 0.7103 44072!pip install -q transformers torch pillow gradio1import gradio as gr
2from transformers import AutoImageProcessor, SiglipForImageClassification
3from PIL import Image
4import torch
5
6# Load model and processor
7model_name = "prithivMLmods/Fashion-Product-Season" # Replace with your actual model path
8model = SiglipForImageClassification.from_pretrained(model_name)
9processor = AutoImageProcessor.from_pretrained(model_name)
10
11# Label mapping
12id2label = {
13 0: "Fall",
14 1: "Spring",
15 2: "Summer",
16 3: "Winter"
17}
18
19def classify_season(image):
20 """Predicts the most suitable season for a fashion product."""
21 image = Image.fromarray(image).convert("RGB")
22 inputs = processor(images=image, return_tensors="pt")
23
24 with torch.no_grad():
25 outputs = model(**inputs)
26 logits = outputs.logits
27 probs = torch.nn.functional.softmax(logits, dim=1).squeeze().tolist()
28
29 predictions = {id2label[i]: round(probs[i], 3) for i in range(len(probs))}
30 predictions = dict(sorted(predictions.items(), key=lambda item: item[1], reverse=True))
31 return predictions
32
33# Gradio interface
34iface = gr.Interface(
35 fn=classify_season,
36 inputs=gr.Image(type="numpy"),
37 outputs=gr.Label(label="Season Prediction Scores"),
38 title="Fashion-Product-Season",
39 description="Upload a fashion product image to predict its most suitable season (Fall, Spring, Summer, Winter)."
40)
41
42# Launch the app
43if __name__ == "__main__":
44 iface.launch()