@staticmethod def ft_in_to_cm(ft: int, inches: float) -> float: return (ft * 12 + inches) * 2.54 class MaleModelHeightAnalyzer: """Feature for analyzing male model heights""" # Industry standard height ranges (cm) RUNWAY_MIN = 185 # 6'1" RUNWAY_MAX = 192 # 6'3.6" COMMERCIAL_MIN = 175 # 5'9" COMMERCIAL_MAX = 190 # 6'2.8" FITNESS_MIN = 178 # 5'10" FITNESS_MAX = 188 # 6'2"
@app.get("/analyze/outliers") async def detect_outliers(multiplier: float = Query(1.5, ge=1.0, le=3.0)): """Detect height outliers using IQR method""" # Implementation would use analyzer pass # Sample data sample_models = [ MaleModel("M001", "John Doe", 188, "6'2\"", "Elite Models", "runway"), MaleModel("M002", "Mike Smith", 185, "6'1\"", "IMG Models", "runway"), MaleModel("M003", "Alex Chen", 178, "5'10\"", "Wilhelmina", "commercial"), MaleModel("M004", "Chris Evans", 183, "6'0\"", "Ford Models", "fitness"), MaleModel("M005", "David Kim", 192, "6'3.6\"", "Next Models", "runway"), MaleModel("M006", "Tom Wilson", 175, "5'9\"", "Elite Models", "commercial"), MaleModel("M007", "James Brown", 195, "6'4.8\"", "IMG Models", "runway"), ] Analyze analyzer = MaleModelHeightAnalyzer(sample_models) print(analyzer.generate_height_report()) Visualize visualizer = HeightVisualizer(analyzer) visualizer.plot_height_distribution("height_analysis.png") Get category fit category_fit = analyzer.category_fit() for model_id, info in category_fit.items(): print(f"{info['name']}: {info['height_ft_in']} - Suitable for {', '.join(info['suitable_categories'])}") height of male models
def generate_height_report(self) -> str: """Generate comprehensive height analysis report""" stats = self.basic_statistics() percentiles = self.percentile_distribution() outliers = self.height_outliers() category_fit = self.category_fit() report = f""" ===== MALE MODEL HEIGHT ANALYSIS REPORT ===== BASIC STATISTICS: - Total Models: {stats.get('count', 0)} - Mean Height: {stats.get('mean', 'N/A')} cm - Median Height: {stats.get('median', 'N/A')} cm - Height Range: {stats.get('min', 'N/A')} - {stats.get('max', 'N/A')} cm - Standard Deviation: {stats.get('std_dev', 'N/A')} cm PERCENTILE DISTRIBUTION: {chr(10).join([f' - {k}: {v} cm' for k, v in percentiles.items()])} CATEGORY SUITABILITY: - Suitable for Runway: {sum(1 for v in category_fit.values() if v['is_ideal_runway'])} models - Below Industry Minimum: {sum(1 for v in category_fit.values() if 'short_for_industry' in v['suitable_categories'])} models - Above Industry Maximum: {sum(1 for v in category_fit.values() if 'tall_for_industry' in v['suitable_categories'])} models OUTLIERS DETECTED: {len(outliers)} {chr(10).join([f' - {o["name"]}: {o["height_ft_in"]} ({o["height_cm"]} cm) - {o["deviation"]} average' for o in outliers])} """ return report import matplotlib.pyplot as plt import seaborn as sns import numpy as np class HeightVisualizer: """Create visualizations for model height analysis""" @staticmethod def ft_in_to_cm(ft: int
from dataclasses import dataclass from datetime import datetime from typing import List, Optional, Dict import statistics @dataclass class MaleModel: id: str name: str height_cm: float # height in centimeters height_ft_in: Optional[str] = None # e.g., "6'1"" agency: Optional[str] = None category: Optional[str] = None # runway, commercial, fitness, etc. measurement_date: Optional[datetime] = None inches: float) ->
@app.post("/analyze/upload-models") async def upload_models(models: List[ModelInput]): """Upload multiple male models for analysis""" model_objects = [MaleModel( id=f"M{idx:04d}", name=m.name, height_cm=m.height_cm, agency=m.agency, category=m.category ) for idx, m in enumerate(models)]
def percentile_distribution(self) -> Dict: """Get height percentiles""" if not self.heights: return {} percentiles = [10, 25, 50, 75, 90, 95, 99] return { f"p{p}": round(statistics.quantiles(self.heights, n=100, method='exclusive')[p-1], 1) for p in percentiles if p-1 < len(statistics.quantiles(self.heights, n=100, method='exclusive')) }
def __post_init__(self): if not self.height_ft_in and self.height_cm: self.height_ft_in = self.cm_to_ft_in(self.height_cm)