Spaces:
Runtime error
Runtime error
| #|export | |
| from fastai.vision.all import * | |
| import gradio as gr | |
| #|export | |
| learn = load_learner('model.pkl') | |
| #|export | |
| def output(img): | |
| predict,index,probs = learn.predict(img) | |
| probs = torch.max(probs) | |
| return f'The picture is appear to be {predict} with probability = {probs}' | |
| #|export | |
| image = gr.inputs.Image(shape=(192,192)) | |
| label = gr.outputs.Label() | |
| examples = ['images/bean.jpg', 'images/tesla.jpg', 'images/Boeing.jpg', 'images/bird.jpg', 'images/boat.jpg', | |
| 'images/french.jpg','images/fat-cat.jpg'] | |
| intf = gr.Interface(fn=output, inputs=image, outputs=label, examples=examples) | |
| intf.launch(inline=True) |