VishnuEcoClim commited on
Commit
ffc09ad
·
1 Parent(s): 495ff33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -7
app.py CHANGED
@@ -30,11 +30,9 @@ opt = st.selectbox("How do you want to upload the image for classification?",
30
  image = None
31
  if opt == 'Upload image from device':
32
  file = st.file_uploader('Select', type=['jpg', 'png', 'jpeg'])
33
- print(file)
34
  if file:
35
  try:
36
  image = Image.open(io.BytesIO(file.read())).resize((256, 256), Image.LANCZOS)
37
- print(image)
38
  except Exception as e:
39
  st.error(f"Error reading the file: {e}")
40
 
@@ -51,17 +49,12 @@ try:
51
  if image is not None:
52
  st.image(image, width = 256, caption = 'Uploaded Image')
53
  if st.button('Predict'):
54
- st.info(print(image))
55
  img = preprocess(image)
56
- st.info(print(img))
57
 
58
  model = model_arc()
59
  #model.load_weights("classify_model.h5")
60
 
61
-
62
- print(model)
63
  prediction = model.predict(img[np.newaxis, ...])
64
- print(prediction)
65
  st.info('Hey! The uploaded image has been classified as " {} waste " '.format(labels[np.argmax(prediction[0], axis=-1)]))
66
  except Exception as e:
67
  st.info(e)
 
30
  image = None
31
  if opt == 'Upload image from device':
32
  file = st.file_uploader('Select', type=['jpg', 'png', 'jpeg'])
 
33
  if file:
34
  try:
35
  image = Image.open(io.BytesIO(file.read())).resize((256, 256), Image.LANCZOS)
 
36
  except Exception as e:
37
  st.error(f"Error reading the file: {e}")
38
 
 
49
  if image is not None:
50
  st.image(image, width = 256, caption = 'Uploaded Image')
51
  if st.button('Predict'):
 
52
  img = preprocess(image)
 
53
 
54
  model = model_arc()
55
  #model.load_weights("classify_model.h5")
56
 
 
 
57
  prediction = model.predict(img[np.newaxis, ...])
 
58
  st.info('Hey! The uploaded image has been classified as " {} waste " '.format(labels[np.argmax(prediction[0], axis=-1)]))
59
  except Exception as e:
60
  st.info(e)