VishnuEcoClim commited on
Commit
9fc025f
·
1 Parent(s): 06f6657

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -29,13 +29,14 @@ opt = st.selectbox("How do you want to upload the image for classification?", ('
29
  if opt == 'Upload image from device':
30
  file = st.file_uploader('Select', type=['jpg', 'png', 'jpeg'])
31
  if file is not None:
32
- image = Image.open(file).resize((256, 256), Image.LANCZOS)
33
-
34
 
35
  elif opt == 'Upload image via link':
36
  img_url = st.text_input('Enter the Image Address')
37
  try:
38
- image = Image.open(urllib.request.urlopen(img_url)).resize((256, 256), Image.LANCZOS)
 
39
  except ValueError:
40
  st.error("Please Enter a valid Image Address!")
41
 
@@ -48,7 +49,7 @@ if 'image' in locals(): # Check if image variable exists
48
  st.info('Worked1')
49
 
50
  # Ensure image shape is correct and add batch dimension
51
- img_array = preprocess(file) # This should return an array of shape (1, 256, 256, 3)
52
 
53
  st.info('Worked2')
54
 
 
29
  if opt == 'Upload image from device':
30
  file = st.file_uploader('Select', type=['jpg', 'png', 'jpeg'])
31
  if file is not None:
32
+ pil_image = Image.open(file)
33
+ image = preprocess(pil_image)
34
 
35
  elif opt == 'Upload image via link':
36
  img_url = st.text_input('Enter the Image Address')
37
  try:
38
+ pil_image = Image.open(urllib.request.urlopen(img_url))
39
+ image = preprocess(pil_image)
40
  except ValueError:
41
  st.error("Please Enter a valid Image Address!")
42
 
 
49
  st.info('Worked1')
50
 
51
  # Ensure image shape is correct and add batch dimension
52
+ img_array = preprocess(image) # This should return an array of shape (1, 256, 256, 3)
53
 
54
  st.info('Worked2')
55