Spaces:
Sleeping
Sleeping
Update src/siglip/classifier.py
Browse files- src/siglip/classifier.py +4 -1
src/siglip/classifier.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
# Necessary imports
|
2 |
import sys
|
3 |
from typing import Dict
|
|
|
4 |
import torch
|
5 |
from transformers import AutoModel, AutoProcessor
|
6 |
import gradio as gr
|
@@ -16,7 +17,9 @@ model = AutoModel.from_pretrained(model_id).eval().to("cpu")
|
|
16 |
processor = AutoProcessor.from_pretrained(model_id)
|
17 |
|
18 |
|
19 |
-
def ZeroShotImageClassification(
|
|
|
|
|
20 |
"""
|
21 |
Performs zero-shot classification on the given image input and candidate labels.
|
22 |
|
|
|
1 |
# Necessary imports
|
2 |
import sys
|
3 |
from typing import Dict
|
4 |
+
from PIL import Image
|
5 |
import torch
|
6 |
from transformers import AutoModel, AutoProcessor
|
7 |
import gradio as gr
|
|
|
17 |
processor = AutoProcessor.from_pretrained(model_id)
|
18 |
|
19 |
|
20 |
+
def ZeroShotImageClassification(
|
21 |
+
image_input: Image.Image, candidate_labels: str
|
22 |
+
) -> Dict[str, float]:
|
23 |
"""
|
24 |
Performs zero-shot classification on the given image input and candidate labels.
|
25 |
|