Spaces:
Runtime error
Runtime error
candidates are passed to classifier
Browse files
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 |
-
|
|
|
|
| 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:
|