Spaces:
Sleeping
Sleeping
Kathir
commited on
Commit
·
f6d05cd
1
Parent(s):
68f7e9f
Added Project files
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ from model import create_vit_b16
|
|
7 |
|
8 |
# loading the classnames
|
9 |
class_names = []
|
10 |
-
with open("
|
11 |
for cls in f.readlines():
|
12 |
class_names.append(cls[:-1])
|
13 |
|
@@ -35,7 +35,7 @@ def predict(img):
|
|
35 |
preds = torch.softmax(pred_logits, dim=1)
|
36 |
|
37 |
# Create a prediction label and prediction probability dictionary for each prediction class
|
38 |
-
pred_and_prob_labels = {class_names[i]: preds[i]
|
39 |
|
40 |
return pred_and_prob_labels
|
41 |
|
|
|
7 |
|
8 |
# loading the classnames
|
9 |
class_names = []
|
10 |
+
with open("class_names.txt", "r") as f:
|
11 |
for cls in f.readlines():
|
12 |
class_names.append(cls[:-1])
|
13 |
|
|
|
35 |
preds = torch.softmax(pred_logits, dim=1)
|
36 |
|
37 |
# Create a prediction label and prediction probability dictionary for each prediction class
|
38 |
+
pred_and_prob_labels = {class_names[i]: preds[i].item() for i in range(len(class_names))}
|
39 |
|
40 |
return pred_and_prob_labels
|
41 |
|