Mr00Magician commited on
Commit
3749ce1
1 Parent(s): 0084ec6

Create new file

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from tensorflow import keras as k
3
+ import numpy as np
4
+
5
+ loaded_SNN = k.models.load_model('SequentialNN.h5')
6
+
7
+ def predict(img):
8
+ img_array = np.array(img)
9
+ img_array = np.array(img_array, dtype = 'int32').reshape(1, 28, 28)
10
+
11
+ pred = loaded_SNN.predict([img_array])
12
+ return np.argmax(pred)
13
+
14
+ iface = gr.Interface(predict, inputs = 'sketchpad',
15
+ outputs = 'text',
16
+ allow_flagging = 'never',
17
+ description = 'Draw a Digit Below... (Draw in the centre for best results)')
18
+ iface.launch(share = True, width = 500, height = 500)