Height Of Male Models Portable -

def category_fit(self) -> Dict[str, Dict]: """Categorize models based on industry standards""" results = {} for model in self.models: fits = [] if self.RUNWAY_MIN <= model.height_cm <= self.RUNWAY_MAX: fits.append("runway") if self.COMMERCIAL_MIN <= model.height_cm <= self.COMMERCIAL_MAX: fits.append("commercial") if self.FITNESS_MIN <= model.height_cm <= self.FITNESS_MAX: fits.append("fitness") # Special classifications if model.height_cm < self.COMMERCIAL_MIN: fits.append("short_for_industry") elif model.height_cm > self.RUNWAY_MAX: fits.append("tall_for_industry") results[model.id] = { "name": model.name, "height_cm": model.height_cm, "height_ft_in": model.height_ft_in, "suitable_categories": fits, "is_ideal_runway": self.RUNWAY_MIN <= model.height_cm <= self.RUNWAY_MAX } return results

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 height of male models

def plot_height_distribution(self, save_path: str = None): """Create histogram with KDE of height distribution""" fig, axes = plt.subplots(2, 2, figsize=(15, 10)) # Histogram with KDE axes[0, 0].hist(self.heights, bins=15, edgecolor='black', alpha=0.7, density=True) sns.kdeplot(self.heights, ax=axes[0, 0], color='red', linewidth=2) axes[0, 0].set_xlabel('Height (cm)') axes[0, 0].set_ylabel('Density') axes[0, 0].set_title('Height Distribution with KDE') axes[0, 0].axvline(statistics.mean(self.heights), color='green', linestyle='--', label='Mean') axes[0, 0].axvline(statistics.median(self.heights), color='orange', linestyle='--', label='Median') axes[0, 0].legend() # Box plot axes[0, 1].boxplot(self.heights, vert=True, patch_artist=True) axes[0, 1].set_ylabel('Height (cm)') axes[0, 1].set_title('Height Distribution Box Plot') axes[0, 1].grid(True, alpha=0.3) # Cumulative distribution sorted_heights = np.sort(self.heights) cumulative = np.arange(1, len(sorted_heights) + 1) / len(sorted_heights) axes[1, 0].plot(sorted_heights, cumulative, marker='.', linestyle='none', markersize=3) axes[1, 0].set_xlabel('Height (cm)') axes[1, 0].set_ylabel('Cumulative Probability') axes[1, 0].set_title('Cumulative Distribution Function') axes[1, 0].grid(True, alpha=0.3) # Category comparison cat_data = self.analyzer.distribution_by_category() categories = list(cat_data.keys()) means = [cat_data[cat]['mean'] for cat in categories] axes[1, 1].bar(categories, means, color=['blue', 'green', 'orange']) axes[1, 1].set_ylabel('Mean Height (cm)') axes[1, 1].set_title('Mean Height by Category') axes[1, 1].grid(True, alpha=0.3, axis='y') plt.tight_layout() if save_path: plt.savefig(save_path, dpi=300, bbox_inches='tight') plt.show() def category_fit(self) -&gt

@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" = model.height_cm &lt

@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 plot_height_by_agency(self, agency_colors: Dict[str, str] = None): """Plot height distribution grouped by agency""" agency_groups = {} for model in self.analyzer.models: if model.agency: if model.agency not in agency_groups: agency_groups[model.agency] = [] agency_groups[model.agency].append(model.height_cm) if not agency_groups: print("No agency data available") return fig, ax = plt.subplots(figsize=(12, 6)) positions = range(len(agency_groups)) bp = ax.boxplot(agency_groups.values(), positions=positions, widths=0.6, patch_artist=True, showmeans=True) # Color boxes if agency_colors: for i, box in enumerate(bp['boxes']): agency = list(agency_groups.keys())[i] box.set_facecolor(agency_colors.get(agency, 'lightblue')) ax.set_xticklabels(agency_groups.keys(), rotation=45, ha='right') ax.set_ylabel('Height (cm)') ax.set_title('Height Distribution by Modeling Agency') ax.grid(True, alpha=0.3, axis='y') plt.tight_layout() plt.show() from fastapi import FastAPI, HTTPException, Query from typing import List, Optional from pydantic import BaseModel app = FastAPI(title="Male Model Height Analysis API")

def basic_statistics(self) -> Dict: """Calculate basic height statistics""" if not self.heights: return {} return { "count": len(self.heights), "mean": round(statistics.mean(self.heights), 1), "median": round(statistics.median(self.heights), 1), "mode": round(statistics.mode(self.heights), 1) if self.heights else None, "min": min(self.heights), "max": max(self.heights), "range": round(max(self.heights) - min(self.heights), 1), "std_dev": round(statistics.stdev(self.heights), 1) if len(self.heights) > 1 else 0, "variance": round(statistics.variance(self.heights), 1) if len(self.heights) > 1 else 0 }