Update app.py
Browse files
app.py
CHANGED
@@ -18,8 +18,6 @@ logging.basicConfig(level=logging.INFO)
|
|
18 |
model = ViTForImageClassification.from_pretrained("ongkn/attraction-classifier")
|
19 |
processor = ViTImageProcessor.from_pretrained("ongkn/attraction-classifier")
|
20 |
|
21 |
-
pipe = pipeline("image-classification", model=model, feature_extractor=processor)
|
22 |
-
|
23 |
faceGrabber = FaceGrabber()
|
24 |
gradCam = GradCam()
|
25 |
|
@@ -50,7 +48,7 @@ def classify_image(input):
|
|
50 |
input_tensor=tensorResized,
|
51 |
input_image=faceResized,
|
52 |
reshape_transform=gradCam.reshape_transform_vit_huggingface)
|
53 |
-
result =
|
54 |
if result[0]["label"] == "pos" and result[0]["score"] > 0.9 and result[0]["score"] < 0.95:
|
55 |
return result[0]["label"], result[0]["score"], str("Nice!"), face, dffImage, gradCamImage
|
56 |
elif result[0]["label"] == "pos" and result[0]["score"] > 0.95:
|
|
|
18 |
model = ViTForImageClassification.from_pretrained("ongkn/attraction-classifier")
|
19 |
processor = ViTImageProcessor.from_pretrained("ongkn/attraction-classifier")
|
20 |
|
|
|
|
|
21 |
faceGrabber = FaceGrabber()
|
22 |
gradCam = GradCam()
|
23 |
|
|
|
48 |
input_tensor=tensorResized,
|
49 |
input_image=faceResized,
|
50 |
reshape_transform=gradCam.reshape_transform_vit_huggingface)
|
51 |
+
result = gradCam.get_top_category(model, tensorResized)
|
52 |
if result[0]["label"] == "pos" and result[0]["score"] > 0.9 and result[0]["score"] < 0.95:
|
53 |
return result[0]["label"], result[0]["score"], str("Nice!"), face, dffImage, gradCamImage
|
54 |
elif result[0]["label"] == "pos" and result[0]["score"] > 0.95:
|