Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -16,13 +16,7 @@ def classify_image_with_text(text, image):
|
|
16 |
outputs = model(**inputs)
|
17 |
logits_per_image = outputs.logits_per_image # this is the image-text similarity score
|
18 |
probs = logits_per_image.softmax(dim=1)
|
19 |
-
|
20 |
-
predicted_class_index = probs.argmax(dim=1).item()
|
21 |
-
# Récupérer le tokenizer associé au processeur
|
22 |
-
tokenizer = processor.tokenizer
|
23 |
-
# Récupérer le label correspondant à l'index
|
24 |
-
label = tokenizer.convert_ids_to_tokens(predicted_class_index)
|
25 |
-
return label
|
26 |
|
27 |
# Créer l'interface Gradio avec l'API de Gradio Blocks
|
28 |
with gr.Interface(
|
|
|
16 |
outputs = model(**inputs)
|
17 |
logits_per_image = outputs.logits_per_image # this is the image-text similarity score
|
18 |
probs = logits_per_image.softmax(dim=1)
|
19 |
+
return probs
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
# Créer l'interface Gradio avec l'API de Gradio Blocks
|
22 |
with gr.Interface(
|