Spaces:
Runtime error
Runtime error
| from fastai.vision.all import * | |
| import gradio as gr | |
| im = PILImage.create('angry.jpg') | |
| im.thumbnail((192,192)) | |
| im | |
| learn = load_learner('model.pkl') | |
| learn.predict(im) | |
| categories = ('not_angry', 'angry') | |
| def classify_images(img): | |
| pred, idx, probs = learn.predict(img) | |
| return dict(zip(categories, map(float,probs))) | |
| image = gr.inputs.Image(shape=(192,192)) | |
| label = gr.outputs.Label() | |
| examples = ['angry.jpg', 'not_angry.jpg'] | |
| intf = gr.Interface(fn=classify_images, inputs=image, outputs=label, examples=examples) | |
| intf.launch(inline=False) |