Spaces:
Runtime error
Runtime error
commit
Browse files- app.py +6 -6
- 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 =
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
X_inf =
|
|
|
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
|