Spaces:
Sleeping
Sleeping
modified model
Browse files
app.py
CHANGED
@@ -14,15 +14,16 @@ labels = model.dls.vocab
|
|
14 |
def predict(img):
|
15 |
img = PILImage.create(img)
|
16 |
pred,pred_idx,probs = model.predict(img)
|
17 |
-
return
|
18 |
|
19 |
if file_name is not None:
|
20 |
col1, col2 = st.columns(2)
|
21 |
image = Image.open(file_name)
|
22 |
col1.image(image, use_column_width=True)
|
23 |
-
|
24 |
-
pred = predict(file_name)
|
25 |
col2.header("Prediction:")
|
26 |
-
|
|
|
|
|
27 |
else:
|
28 |
st.write('Please upload a file!')
|
|
|
14 |
def predict(img):
|
15 |
img = PILImage.create(img)
|
16 |
pred,pred_idx,probs = model.predict(img)
|
17 |
+
return dict(zip(labels, map(float, probs)))
|
18 |
|
19 |
if file_name is not None:
|
20 |
col1, col2 = st.columns(2)
|
21 |
image = Image.open(file_name)
|
22 |
col1.image(image, use_column_width=True)
|
23 |
+
predictions = predict(file_name)
|
|
|
24 |
col2.header("Prediction:")
|
25 |
+
for p in predictions:
|
26 |
+
st.write(p)
|
27 |
+
#col2.subheader(f"{ p['label'] }: { round(p['probs'] * 100, 1)}%")
|
28 |
else:
|
29 |
st.write('Please upload a file!')
|