Ammar971 commited on
Commit
49da6b5
·
1 Parent(s): f52cc02

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -28,6 +28,13 @@ test=test_images[0].reshape(-1,28,28)
28
  pred=model.predict(test)
29
  print(pred)
30
 
 
 
 
 
 
 
 
31
  iface = gr.Interface(predict_image, inputs="sketchpad", outputs="label")
32
 
33
  iface.launch(debug='True')
 
28
  pred=model.predict(test)
29
  print(pred)
30
 
31
+ def predict_image(img):
32
+ img_3d=img.reshape(-1,28,28)
33
+ im_resize=img_3d/255.0
34
+ prediction=model.predict(im_resize)
35
+ pred=np.argmax(prediction)
36
+ return pred
37
+
38
  iface = gr.Interface(predict_image, inputs="sketchpad", outputs="label")
39
 
40
  iface.launch(debug='True')