isingh commited on
Commit
8a17b6b
β€’
1 Parent(s): 59e9ce4

candidates are passed to classifier

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -4,8 +4,9 @@ from transformers import pipeline
4
  checkpoint = "openai/clip-vit-large-patch14"
5
  detector = pipeline(model=checkpoint, task="zero-shot-image-classification")
6
 
7
- def classify(img):
8
- predictions = detector(img, candidate_labels=["fox", "bear", "seagull", "owl"])
 
9
  return predictions
10
 
11
  with gr.Blocks() as iface:
 
4
  checkpoint = "openai/clip-vit-large-patch14"
5
  detector = pipeline(model=checkpoint, task="zero-shot-image-classification")
6
 
7
+ def classify(img, candidates):
8
+ labels = candidates.split(sep=",")
9
+ predictions = detector(img, candidate_labels=labels)
10
  return predictions
11
 
12
  with gr.Blocks() as iface: