Spaces:
Runtime error
Runtime error
from fastai.vision.all import * | |
import gradio as gr | |
import skimage | |
learn = load_learner('model.pkl') | |
categories = ['damaged power lines', 'normal power lines'] | |
def predict(img): | |
img = PILImage.create(img) | |
pred, idx, probs = learn.predict(img) | |
return dict(zip(categories, map(float, probs))) | |
images = gr.components.Image(shape=(512, 512)) | |
labels = gr.outputs.Label() | |
examples = ['powerline_down.jpg', 'powerline_tree.jpg'] | |
title = "Power Line after Disaster Classifier" | |
description = "A classifier trained to identify power lines, trees on power lines after a storm. Created as a demo for fastai. Copyright: Apagon LLC." | |
interpretation = 'default' | |
enable_queue = True | |
intf = gr.Interface(fn=predict, | |
inputs=images, | |
outputs=labels, | |
examples=examples, | |
title=title, | |
description=description, | |
interpretation=interpretation) | |
intf.launch(enable_queue=enable_queue) | |