import gradio as gr from transformers import AutoImageProcessor, AutoModelForObjectDetection from PIL import Image import torch # Modelo que detecta prendas de vestir model_name = "yainage90/fashion-object-detection" processor = AutoImageProcessor.from_pretrained(model_name) model = AutoModelForObjectDetection.from_pretrained(model_name) # Precios fijos por prenda (estimados) PRECIOS = { 'top': 7000, 'bottom': 18000, 'shoes': 25000, 'bag': 15000, 'outer': 22000 } def estimar_precio(imagen): inputs = processor(images=imagen, return_tensors="pt") outputs = model(**inputs) target_size = [imagen.height, imagen.width] results = processor.post_process_object_detection(outputs, threshold=0.5, target_sizes=[target_size])[0] total = 0 resumen = [] for score, label, box in zip(results["scores"], results["labels"], results["box]()