| import numpy as np | |
| import gradio as gr | |
| from tensorflow import keras | |
| model = keras.models.load_model('digits_recognition') | |
| def greet(img): | |
| img = np.expand_dims(img, axis=0) | |
| return np.argmax(model.predict(img)[0]) | |
| demo = gr.Interface(fn=greet, inputs="sketchpad", outputs="text") | |
| demo.launch() |