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="

Project Github Repository

" examples = ['fragment_1.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()