Spaces:
Sleeping
Sleeping
captions along with probs
Browse files
app.py
CHANGED
@@ -10,12 +10,12 @@ def inference(input_img, captions):
|
|
10 |
outputs = clip(**inputs)
|
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
|
19 |
|
20 |
examples = [
|
21 |
["examples/woman_standing.jpg","woman standing inside a house, a photo of dog, running water, cupboard, home interiors"],
|
|
|
10 |
outputs = clip(**inputs)
|
11 |
# this is the image-text similarity score
|
12 |
logits_per_image = outputs.logits_per_image
|
13 |
+
probs = logits_per_image.softmax(dim=1).tolist()[0]
|
14 |
+
confidences = {captions_list[i][:30]: 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 to predict the appropriate caption for an image"
|
19 |
|
20 |
examples = [
|
21 |
["examples/woman_standing.jpg","woman standing inside a house, a photo of dog, running water, cupboard, home interiors"],
|