Spaces:
Runtime error
Runtime error
| from fastai.learner import * | |
| from fastai.vision import * | |
| import gradio as gr | |
| learner = load_learner('doc_classifier_model.pkl') | |
| categories = learner.dls.vocab | |
| def classify_doc(img): | |
| pred, idx, probs = learner.predict(img) | |
| return dict(zip(categories, map(float, probs))) | |
| image = gr.inputs.Image(shape=(224, 224)) | |
| label = gr.outputs.Label(num_top_classes=3) | |
| examples = [ | |
| ['factura.jpg'], | |
| ['boleta.jpg'], | |
| ['formulario.jpg'] | |
| ] | |
| iface = gr.Interface(fn=classify_doc, inputs=image, outputs=label, examples=examples) | |
| iface.launch(inline=False) |