Spaces:
Sleeping
Sleeping
def predict(img): | |
# Preprocess the input image | |
img = img.reshape(1, 28, 28) / 255.0 | |
# Make the prediction | |
prediction = model.predict(img) | |
predicted_digit = np.argmax(prediction[0]) | |
return predicted_digit | |
with gr.Blocks() as demo: | |
gr.Markdown("Welcome on your first sketch recognition app!") | |
with gr.Row(): | |
scratchpad = gr.Scratchpad(shape=(28, 28)) | |
output = gr.Text() | |
btn = gr.Button("Submit") | |
btn.click(predict, inputs=scratchpad, outputs=output) | |
demo.launch() |