detectionotfit / app_simple.py
MODLI's picture
Create app_simple.py
d06e1fd verified
raw
history blame contribute delete
556 Bytes
import gradio as gr
from transformers import pipeline
# Modèle simple sans segmentation
model = pipeline("zero-shot-image-classification",
model="openai/clip-vit-base-patch32")
categories = ["t-shirt", "dress", "jeans", "jacket", "shoes"]
def classify(image):
results = model(image, candidate_labels=categories)
return "\n".join([f"{r['label']}: {r['score']*100:.1f}%" for r in results])
gr.Interface(
fn=classify,
inputs=gr.Image(type="pil"),
outputs=gr.Textbox(),
title="Simple Fashion Classifier"
).launch()