Vallam1 commited on
Commit
3c42fee
1 Parent(s): 5bc8a9d

Create new file

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import numpy as np
3
+ import tensorflow as tf
4
+ from tensorflow import keras
5
+ from keras.models import load_model
6
+
7
+ def cnn_model_binary(image):
8
+ loaded_cnn_model = load_model("cnn_model_binary.h5")
9
+ prediction = loaded_cnn_model.predict(np.array([image]))
10
+ return "NO" if prediction[0][0] != 1 else "YES"
11
+
12
+ input_image = gr.inputs.Image(shape=(28, 28), image_mode='L')
13
+ output_label = gr.outputs.Textbox(label="Is the digit 1?")
14
+
15
+ gr.Interface(fn=cnn_model_binary, inputs = input_image, outputs = output_label, title = "Predict whether the digit is 1 or not").launch(debug=True)