debug
Browse files
app.py
CHANGED
@@ -29,14 +29,12 @@ imagenet_classes = load_text_lines(IMAGENET_CLASSES_FILE)
|
|
29 |
|
30 |
|
31 |
def classify_image(input_image) -> str:
|
32 |
-
print(type(input_image))
|
33 |
inputs = processor(
|
34 |
-
text=
|
35 |
images=input_image,
|
36 |
return_tensors="pt",
|
37 |
padding=True)
|
38 |
outputs = model(**inputs)
|
39 |
-
print(outputs)
|
40 |
probs = outputs.logits_per_image.softmax(dim=1)
|
41 |
class_index = np.argmax(probs.detach().numpy())
|
42 |
return imagenet_classes[class_index]
|
|
|
29 |
|
30 |
|
31 |
def classify_image(input_image) -> str:
|
|
|
32 |
inputs = processor(
|
33 |
+
text=['dog', 'person'],
|
34 |
images=input_image,
|
35 |
return_tensors="pt",
|
36 |
padding=True)
|
37 |
outputs = model(**inputs)
|
|
|
38 |
probs = outputs.logits_per_image.softmax(dim=1)
|
39 |
class_index = np.argmax(probs.detach().numpy())
|
40 |
return imagenet_classes[class_index]
|