emirkaanozdemr commited on
Commit
0df413f
·
verified ·
1 Parent(s): 9ed3445

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +22 -0
  2. my_model.h5 +3 -0
  3. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from PIL import Image
3
+ from tensorflow.keras.models import load_model
4
+ import numpy as np
5
+
6
+ model=load_model("my_model.h5")
7
+ st.title("MNIST Dataset Predictor")
8
+ img=st.camera_input("Camera")
9
+ def process(input_image):
10
+ input_image=input_image.resize((28,28)).convert("L")
11
+ input_image=np.array(input_image)
12
+ input_image=input_image/255
13
+ input_image=np.expand_dims(input_image,axis=0)
14
+ input_image=input_image.reshape(1,28,28,1)
15
+ return input_image
16
+ if img is not None:
17
+ img=Image.open(img)
18
+ image=process(img)
19
+ prediction=model.predict(image)
20
+ predicted_class=np.argmax(prediction)
21
+ class_names=["T-shirt/top","Trouser","Pullover","Dress","Coat","Sandal","Shirt","Sneaker","Bag","Ankle boot"]
22
+ st.write(class_names[predicted_class])
my_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b75d2dcb69a1b6547f1f404d9777ff471197a0e3411b8e8fabd0b3d0b0aba41
3
+ size 2730968
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ pillow
2
+ tensorflow
3
+ numpy
4
+ streamlit