Spaces:
Runtime error
Runtime error
Create new file
Browse files
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)
|