Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -12,8 +12,11 @@ def classify_image_with_text(text, image):
|
|
12 |
inputs = processor(
|
13 |
text=[text], images=image, return_tensors="pt", padding=True
|
14 |
)
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
17 |
# Créer l'interface Gradio avec l'API de Gradio Blocks
|
18 |
with gr.Interface(
|
19 |
fn=classify_image_with_text,
|
|
|
12 |
inputs = processor(
|
13 |
text=[text], images=image, return_tensors="pt", padding=True
|
14 |
)
|
15 |
+
outputs = model(**inputs)
|
16 |
+
logits_per_image = outputs.logits_per_image # this is the image-text similarity score
|
17 |
+
probs = logits_per_image.softmax(dim=1)
|
18 |
+
return probs
|
19 |
+
|
20 |
# Créer l'interface Gradio avec l'API de Gradio Blocks
|
21 |
with gr.Interface(
|
22 |
fn=classify_image_with_text,
|