Spaces:
Running
Running
Commit
·
f434ef0
1
Parent(s):
94e1bda
Update app.py
Browse files
app.py
CHANGED
@@ -41,9 +41,17 @@ elif opt == 'Upload image via link':
|
|
41 |
time.sleep(4)
|
42 |
show.empty()
|
43 |
|
44 |
-
|
45 |
-
|
|
|
46 |
if st.button('Predict'):
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
time.sleep(4)
|
42 |
show.empty()
|
43 |
|
44 |
+
try:
|
45 |
+
if image is not None:
|
46 |
+
st.image(image, width = 300, caption = 'Uploaded Image')
|
47 |
if st.button('Predict'):
|
48 |
+
img = preprocess(image)
|
49 |
+
|
50 |
+
model = model_arc()
|
51 |
+
model.load_weights("classify_model.h5")
|
52 |
+
|
53 |
+
prediction = model.predict(img[np.newaxis, ...])
|
54 |
+
st.info('Hey! The uploaded image has been classified as " {} waste " '.format(labels[np.argmax(prediction[0], axis=-1)]))
|
55 |
+
except Exception as e:
|
56 |
+
st.info(e)
|
57 |
+
pass
|