Spaces:
Sleeping
Sleeping
Commit
·
b31f703
1
Parent(s):
cbc492c
Update app.py
Browse files
app.py
CHANGED
@@ -36,14 +36,12 @@ with open("list.dat", 'rb') as f:
|
|
36 |
model = load_learner("model.pkl")
|
37 |
|
38 |
def predict(img):
|
39 |
-
logging.warning(f"{
|
40 |
try:
|
41 |
logging.warning(f"Shape: {img.shape}")
|
42 |
except AttributeError:
|
43 |
logging.warning(f"Size: {img.size}")
|
44 |
pred, idx, probs = model.predict(img)
|
45 |
-
logging.debug(f"{type(probs)}")
|
46 |
-
logging.debug(f"{type(probs[0])}")
|
47 |
dict1 = dict(zip(categories, map(float, probs.numpy())))
|
48 |
dict1 = dict(sorted(dict1.items(), key=lambda item : item[1]))
|
49 |
output = {key:dict1[key] for key in list(dict1.keys())[-3:]}
|
|
|
36 |
model = load_learner("model.pkl")
|
37 |
|
38 |
def predict(img):
|
39 |
+
logging.warning(f"{type(image)}")
|
40 |
try:
|
41 |
logging.warning(f"Shape: {img.shape}")
|
42 |
except AttributeError:
|
43 |
logging.warning(f"Size: {img.size}")
|
44 |
pred, idx, probs = model.predict(img)
|
|
|
|
|
45 |
dict1 = dict(zip(categories, map(float, probs.numpy())))
|
46 |
dict1 = dict(sorted(dict1.items(), key=lambda item : item[1]))
|
47 |
output = {key:dict1[key] for key in list(dict1.keys())[-3:]}
|