Spaces:
Sleeping
Sleeping
Commit ·
9a3454a
1
Parent(s): b9c30df
main_push
Browse files- app.py +21 -0
- fragment_1.jpg +0 -0
- requirements.txt +0 -0
- resnet50_m0.pkl +3 -0
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import skimage
|
| 3 |
+
from fastai.vision.all import *
|
| 4 |
+
|
| 5 |
+
learn = load_learner('resnet50_m0.pkl')
|
| 6 |
+
labels = learn.dls.vocab
|
| 7 |
+
|
| 8 |
+
def predict(img):
|
| 9 |
+
img = PILImage.create(img)
|
| 10 |
+
pred,pred_idx,probs = learn.predict(img)
|
| 11 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 12 |
+
|
| 13 |
+
title = "Satellite Image Deforestation Classifier"
|
| 14 |
+
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."
|
| 15 |
+
article="<p style='text-align: center'><a href='https://github.com/LucianCotolan/sas-image-deforestification' target='_blank'>Project Github Repository</a></p>"
|
| 16 |
+
examples = ['fragment_1.jpg']
|
| 17 |
+
|
| 18 |
+
interpretation='default'
|
| 19 |
+
enable_queue=True
|
| 20 |
+
|
| 21 |
+
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()
|
fragment_1.jpg
ADDED
|
requirements.txt
ADDED
|
File without changes
|
resnet50_m0.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:844993df2c0c26fcf4a38b9b1b70f8f75685e432763ec2503b32fdcd4cb6ffe2
|
| 3 |
+
size 103470446
|