import gradio as gr from fastai.vision.all import * import skimage learn = load_learner('model.pkl') categories = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9') def classify_image(img): pred,idx,probs = learn.predict(img) return dict(zip(categories, map(float,probs))) image = gr.inputs.Image(shape=(100,100)) label = gr.outputs.Label() title = "Sign Language Digit Classifier" description = "A sign language digit classifier trained on a Kaggle dataset with fast.ai. Click on an example (6, 7, and 8) or upload an image and let the model classify it for you!" interpretation='default' examples= ['6.JPG', '7.JPG', '8.JPG'] enable_queue=True gr.Interface(fn=classify_image,inputs=gr.inputs.Image(shape=(100, 100)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,examples=examples).launch()