jableable commited on
Commit
f2669ad
·
verified ·
1 Parent(s): be6b094

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -4,6 +4,7 @@ from transformers import pipeline
4
  from huggingface_hub import from_pretrained_keras
5
  import keras
6
  import numpy as np
 
7
 
8
  loaded_model = keras.saving.load_model("best_model.keras")
9
 
@@ -11,7 +12,9 @@ uploaded_img = st.file_uploader("Upload your file here...",type=['png', 'jpeg',
11
 
12
  if uploaded_img is not None:
13
  st.image(uploaded_img)
14
- array = np.array(uploaded_img)
 
 
15
  result = loaded_model.predict(array)
16
  st.write(f"Your prediction is: {result}")
17
 
 
4
  from huggingface_hub import from_pretrained_keras
5
  import keras
6
  import numpy as np
7
+ from PIL import Image
8
 
9
  loaded_model = keras.saving.load_model("best_model.keras")
10
 
 
12
 
13
  if uploaded_img is not None:
14
  st.image(uploaded_img)
15
+ img = Image.open(uploaded_img)
16
+ resized_image = image.resize((320,320))
17
+ array = np.array(resized_image)
18
  result = loaded_model.predict(array)
19
  st.write(f"Your prediction is: {result}")
20