MODLI commited on
Commit
d06e1fd
·
verified ·
1 Parent(s): 4c5319b

Create app_simple.py

Browse files
Files changed (1) hide show
  1. app_simple.py +19 -0
app_simple.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Modèle simple sans segmentation
5
+ model = pipeline("zero-shot-image-classification",
6
+ model="openai/clip-vit-base-patch32")
7
+
8
+ categories = ["t-shirt", "dress", "jeans", "jacket", "shoes"]
9
+
10
+ def classify(image):
11
+ results = model(image, candidate_labels=categories)
12
+ return "\n".join([f"{r['label']}: {r['score']*100:.1f}%" for r in results])
13
+
14
+ gr.Interface(
15
+ fn=classify,
16
+ inputs=gr.Image(type="pil"),
17
+ outputs=gr.Textbox(),
18
+ title="Simple Fashion Classifier"
19
+ ).launch()