nelbarman053
commited on
Commit
•
ad70b89
1
Parent(s):
3548420
Error fixed
Browse files
app.py
CHANGED
@@ -17,9 +17,9 @@ from torchvision import transforms
|
|
17 |
from pytorch_grad_cam import GradCAM
|
18 |
from pytorch_grad_cam.utils.model_targets import ClassifierOutputTarget
|
19 |
|
20 |
-
import pathlib
|
21 |
-
temp = pathlib.PosixPath
|
22 |
-
pathlib.PosixPath = pathlib.WindowsPath
|
23 |
|
24 |
model = load_learner("models/recognizer_model.pkl")
|
25 |
|
@@ -209,8 +209,16 @@ def classify_image(image_path):
|
|
209 |
|
210 |
# return image_path, information, dict(zip(labels, map(float, probs)))
|
211 |
# print(information)
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
-
|
|
|
|
|
214 |
|
215 |
# classify_image('test images/unknown_01.jpg')
|
216 |
|
|
|
17 |
from pytorch_grad_cam import GradCAM
|
18 |
from pytorch_grad_cam.utils.model_targets import ClassifierOutputTarget
|
19 |
|
20 |
+
# import pathlib
|
21 |
+
# temp = pathlib.PosixPath
|
22 |
+
# pathlib.PosixPath = pathlib.WindowsPath
|
23 |
|
24 |
model = load_learner("models/recognizer_model.pkl")
|
25 |
|
|
|
209 |
|
210 |
# return image_path, information, dict(zip(labels, map(float, probs)))
|
211 |
# print(information)
|
212 |
+
|
213 |
+
information = f'''
|
214 |
+
Scientific Name: {information['scientific name']}\n
|
215 |
+
Taste: {information['taste'].capitalize()}\n
|
216 |
+
Availability: {information['found'].capitalize()}
|
217 |
+
'''
|
218 |
|
219 |
+
print(information)
|
220 |
+
|
221 |
+
return xai_image, str(information), dict(zip(labels, map(float, probs)))
|
222 |
|
223 |
# classify_image('test images/unknown_01.jpg')
|
224 |
|