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