casheu commited on
Commit
64b7b6d
1 Parent(s): c17fd53
Files changed (2) hide show
  1. app.py +6 -6
  2. requirements.txt +0 -1
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import tensorflow as tf
2
  from tensorflow.keras.models import load_model
3
  import streamlit as st
4
- import cv2
5
  from PIL import Image
6
  import numpy as np
7
 
@@ -10,11 +9,12 @@ model = load_model('model.h5')
10
 
11
  def run():
12
  upload = st.file_uploader("Please upload an image", type=["jpg", "png"])
13
- img = cv2.imread('test.png')
14
- image_fromarray = Image.fromarray(img, 'RGB')
15
- resize_image = image_fromarray.resize((32, 32))
16
- X_inf = np.array(resize_image)
17
- X_inf = X_inf/255
 
18
 
19
  inf_pred = model.predict(X_inf)
20
  inf_class =np.argmax(inf_pred,axis=1)
 
1
  import tensorflow as tf
2
  from tensorflow.keras.models import load_model
3
  import streamlit as st
 
4
  from PIL import Image
5
  import numpy as np
6
 
 
9
 
10
  def run():
11
  upload = st.file_uploader("Please upload an image", type=["jpg", "png"])
12
+ img = Image.open(upload)
13
+ resize_image = img.resize((32, 32))
14
+ X = np.array(resize_image)
15
+ X = X/255
16
+ X_inf = np.expand_dims(X, axis=0)
17
+ X_inf.shape
18
 
19
  inf_pred = model.predict(X_inf)
20
  inf_class =np.argmax(inf_pred,axis=1)
requirements.txt CHANGED
@@ -1,4 +1,3 @@
1
  streamlit
2
  tensorflow
3
- cv2
4
  numpy
 
1
  streamlit
2
  tensorflow
 
3
  numpy