| import random |
| from datetime import datetime |
|
|
| class TrendPredictor: |
| def __init__(self): |
| self.current_trends = { |
| 'colors': ['#FF6B6B', '#4ECDC4', '#FFE66D', '#95E77E', '#C7B9FF'], |
| 'styles': ['Oversized blazers', 'Cargo pants', 'Corset tops', 'Y2K revival', 'Sustainable fashion'], |
| 'fabrics': ['Crochet', 'Mesh', 'Leather', 'Denim', 'Sheer fabrics'], |
| 'silhouettes': ['Oversized', 'Bodycon', 'A-line', 'Crop top + high waist', 'Flared'] |
| } |
| |
| self.seasonal_colors = { |
| 'spring': ['Pastel pink', 'Mint green', 'Lavender', 'Baby blue', 'Butter yellow'], |
| 'summer': ['Neon green', 'Hot pink', 'Electric blue', 'Coral', 'Bright yellow'], |
| 'fall': ['Burgundy', 'Olive green', 'Mustard', 'Rust orange', 'Brown'], |
| 'winter': ['Deep red', 'Emerald', 'Navy', 'Plum', 'Silver'] |
| } |
| |
| def get_current_trends(self, category: str = None) -> dict: |
| month = datetime.now().month |
| season = self._get_season(month) |
| |
| if category == 'colors': |
| colors = self.seasonal_colors.get(season, self.seasonal_colors['spring']) |
| return {"colors": colors, "season": season} |
| elif category == 'styles': |
| return {"styles": self.current_trends['styles'], "season": season} |
| elif category == 'fabrics': |
| return {"fabrics": self.current_trends['fabrics'], "season": season} |
| else: |
| return { |
| "colors": self.current_trends['colors'][:3], |
| "styles": self.current_trends['styles'][:3], |
| "fabrics": self.current_trends['fabrics'][:3], |
| "silhouettes": self.current_trends['silhouettes'][:3], |
| "forecast": self._generate_forecast(), |
| "season": season |
| } |
| |
| def _get_season(self, month: int) -> str: |
| if month in [3, 4, 5]: |
| return 'spring' |
| elif month in [6, 7, 8]: |
| return 'summer' |
| elif month in [9, 10, 11]: |
| return 'fall' |
| else: |
| return 'winter' |
| |
| def _generate_forecast(self) -> list: |
| return [ |
| "Sustainable materials will continue to dominate", |
| "Bold colors making a comeback", |
| "Comfort-focused silhouettes remain popular", |
| "Vintage and upcycled fashion trending" |
| ] |