Spaces:
Runtime error
Runtime error
import gradio as gr | |
import numpy as np | |
from modelutil import create_model | |
def predict_digit(image): | |
try: | |
if image == None: pass | |
except: | |
model = create_model() | |
predictions = model.predict(image.reshape(1, 28, 28)) | |
return np.argmax(predictions) | |
gr.Interface( | |
title="MNIST Digit Classifier", | |
fn=predict_digit, | |
inputs=gr.Sketchpad( label="Draw a digit"), | |
outputs="number", | |
live=True | |
).launch() | |