venkyyuvy commited on
Commit
7e03287
·
1 Parent(s): 7f4983c

captions along with probs

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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 using Gradio interface that accepts an image and some captions, and displays a probability score with which each caption describes the image "
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"],