Spaces:
Running
Running
Commit
·
dfa03a1
1
Parent(s):
35e7ead
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,26 +44,24 @@ elif opt == 'Upload image via link':
|
|
| 44 |
except ValueError:
|
| 45 |
st.error("Please Enter a valid Image Address!")
|
| 46 |
|
| 47 |
-
|
| 48 |
-
|
| 49 |
st.image(image, width=256, caption='Uploaded Image')
|
| 50 |
-
|
| 51 |
-
|
| 52 |
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
|
| 60 |
-
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
|
| 68 |
-
except ValueError:
|
| 69 |
-
print("Value Error")
|
|
|
|
| 44 |
except ValueError:
|
| 45 |
st.error("Please Enter a valid Image Address!")
|
| 46 |
|
| 47 |
+
|
| 48 |
+
if image is not None:
|
| 49 |
st.image(image, width=256, caption='Uploaded Image')
|
| 50 |
+
if st.button('Predict'):
|
| 51 |
+
prediction = model.predict(image[np.newaxis, ...])
|
| 52 |
|
| 53 |
+
print("---------------img-array---------------------")
|
| 54 |
+
print(image[np.newaxis, ...])
|
| 55 |
+
print("------------summary------------------------")
|
| 56 |
+
print(model.summary())
|
| 57 |
+
print("------------------------------------")
|
| 58 |
+
print(prediction)
|
| 59 |
|
| 60 |
+
st.info('Hey! The uploaded image has been classified as " {} waste " '.format(labels[np.argmax(prediction[0], axis=-1)]))
|
| 61 |
|
| 62 |
+
def message(img):
|
| 63 |
+
if img == 'paper' or 'cardboard' or 'metal' or 'glass':
|
| 64 |
+
return (" therefore your item is recyclable. Please refer to https://www.wm.com/us/en/drop-off-locations to find a drop-off location near you.")
|
| 65 |
+
elif img == 'plastic':
|
| 66 |
+
return ("therefore your item may have a chance of being recyclable.")
|
| 67 |
|
|
|
|
|
|