Mnist-Digits / app.py
cisemh's picture
Update app.py
8b99b5a verified
raw
history blame
819 Bytes
import gradio as gr
import tensorflow as tf
import numpy as np
title = "Welcome on your first sketch recognition app!"
head = (
"<center>"
"The robot was trained to classify numbers (from 0 to 9). To test it, write your number in the space provided."
"</center>"
)
# Model yükleniyor
model = tf.keras.models.load_model("number_recognition_model_colab.keras")
def recognize_digit(image):
prediction = model.predict(np.reshape(image, (1, 28, 28))).tolist()[0]
return {str(i): prediction[i] for i in range(10)}
sketchpad = gr.Sketchpad(shape=(28, 28))
gr.Interface(fn=recognize_digit,
inputs=sketchpad,
outputs="label",
title="Handwritten Digits Classifier",
description="This app uses lenet5 for handwritten digits classification").launch()