Mr00Magician
commited on
Commit
•
eda84c0
1
Parent(s):
1e8ae4b
added main file
Browse files- SequentialNN.h5 +3 -0
- app.py +20 -0
SequentialNN.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f00351264e6498c9a8ee921da943ba43baab5ec6b09c74fe241605b1b26313db
|
3 |
+
size 1453296
|
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from turtle import width
|
2 |
+
import gradio as gr
|
3 |
+
from tensorflow import keras as k
|
4 |
+
import numpy as np
|
5 |
+
|
6 |
+
loaded_SNN = k.models.load_model('SequentialNN.h5')
|
7 |
+
|
8 |
+
def predict(img):
|
9 |
+
img_array = np.array(img)
|
10 |
+
img_array = np.array(img_array, dtype = 'int32').reshape(1, 28, 28)
|
11 |
+
|
12 |
+
pred = loaded_SNN.predict([img_array])
|
13 |
+
return np.argmax(pred)
|
14 |
+
|
15 |
+
if __name__ == '__main__':
|
16 |
+
iface = gr.Interface(predict, inputs = 'sketchpad',
|
17 |
+
outputs = 'text',
|
18 |
+
allow_flagging = 'never',
|
19 |
+
description = 'Draw a Digit Below... (Draw in the centre for best results)')
|
20 |
+
iface.launch(share = True, width = 500, height = 500)
|