npc0 commited on
Commit
e083d3d
1 Parent(s): 904b5dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -4,7 +4,7 @@ import pytesseract
4
  import yolov5
5
 
6
  from transformers import CLIPProcessor, CLIPModel
7
- model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
8
  processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
9
 
10
  # load model
@@ -43,7 +43,7 @@ def zero_shot_classification(image, labels):
43
  padding=True)
44
  print(type(inputs))
45
  print(inputs)
46
- outputs = model(**inputs)
47
  logits_per_image = outputs.logits_per_image # this is the image-text similarity score
48
  return logits_per_image.softmax(dim=1) # we can take the softmax to get the label probabilities
49
 
 
4
  import yolov5
5
 
6
  from transformers import CLIPProcessor, CLIPModel
7
+ vit_model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
8
  processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
9
 
10
  # load model
 
43
  padding=True)
44
  print(type(inputs))
45
  print(inputs)
46
+ outputs = vit_model(**inputs)
47
  logits_per_image = outputs.logits_per_image # this is the image-text similarity score
48
  return logits_per_image.softmax(dim=1) # we can take the softmax to get the label probabilities
49