Spaces:
Sleeping
Sleeping
label prob output
Browse files
app.py
CHANGED
@@ -11,8 +11,8 @@ def inference(input_img, captions):
|
|
11 |
# this is the image-text similarity score
|
12 |
logits_per_image = outputs.logits_per_image
|
13 |
probs = logits_per_image.softmax(dim=1)
|
14 |
-
|
15 |
-
return
|
16 |
|
17 |
title = "CLIP Inference: Application using a pretrained CLIP model"
|
18 |
description = "An application using Gradio interface that accepts an image and some captions, and displays a probability score with which each caption describes the image "
|
@@ -31,6 +31,7 @@ demo = gr.Interface(
|
|
31 |
gr.Image(shape=(416, 416), label="Input Image"),
|
32 |
gr.Textbox(placeholder="List of captions")],
|
33 |
outputs = [gr.Textbox(label="Probability score on captions likely describing the image")],
|
|
|
34 |
title = title,
|
35 |
description = description,
|
36 |
examples = examples,
|
|
|
11 |
# this is the image-text similarity score
|
12 |
logits_per_image = outputs.logits_per_image
|
13 |
probs = logits_per_image.softmax(dim=1)
|
14 |
+
confidences = {i: probs[i] for i in range(len(probs))}
|
15 |
+
return confidences
|
16 |
|
17 |
title = "CLIP Inference: Application using a pretrained CLIP model"
|
18 |
description = "An application using Gradio interface that accepts an image and some captions, and displays a probability score with which each caption describes the image "
|
|
|
31 |
gr.Image(shape=(416, 416), label="Input Image"),
|
32 |
gr.Textbox(placeholder="List of captions")],
|
33 |
outputs = [gr.Textbox(label="Probability score on captions likely describing the image")],
|
34 |
+
outputs = gr.Label(),
|
35 |
title = title,
|
36 |
description = description,
|
37 |
examples = examples,
|