Spaces:
Sleeping
Sleeping
import gradio as gr | |
import skimage | |
from fastai.vision.all import * | |
learn = load_learner('resnet50_m0.pkl') | |
labels = learn.dls.vocab | |
def predict(img): | |
img = PILImage.create(img) | |
pred,pred_idx,probs = learn.predict(img) | |
return {labels[i]: float(probs[i]) for i in range(len(labels))} | |
title = "Satellite Image Deforestation Classifier" | |
description = "A deep learning model based on ResNet50 that can classify satellite images into two categories - deforestation (a deforestation event occured in the image) or not_deforestation." | |
article="<p style='text-align: center'><a href='https://github.com/LucianCotolan/sas-image-deforestification' target='_blank'>Project Github Repository</a></p>" | |
examples = ['fragment_1.jpg', 'fragment_2.jpg', 'fragment_3.jpg', 'fragment_4.jpg'] | |
interpretation='default' | |
enable_queue=True | |
gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(224, 224)),outputs=gr.outputs.Label(),title=title,description=description,article=article,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch() |