Spaces:
Runtime error
Runtime error
aneesha
commited on
Commit
•
22f9a5a
1
Parent(s):
845b8b5
Code for gradio to load and display classification output
Browse files- .gitattributes +1 -0
- app.py +15 -4
- cirrus.jpg +0 -0
- cloudmodel.pkl +3 -0
- cumulus.jpg +0 -0
- requirements.txt +2 -0
.gitattributes
CHANGED
@@ -25,3 +25,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
25 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
25 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -1,8 +1,19 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
|
5 |
+
learn = load_learner('cloudmodel.pkl')
|
|
|
6 |
|
7 |
+
labels = learn.dls.vocab
|
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 = "Cloud Classifier"
|
14 |
+
description = "A cirrus and cumulus cloud classifier trained on photos downloaded from DuckDuckGo. Created for Lesson 2 of the 2022 Fast AI Part 1 Course."
|
15 |
+
examples = ['cirrus.jpg', 'cumulus.jpg']
|
16 |
+
interpretation='default'
|
17 |
+
enable_queue=True
|
18 |
+
|
19 |
+
gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
|
cirrus.jpg
ADDED
cloudmodel.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c36a403ad350a9b5bab2acfa6563f9215d734d6e62facae818fa501d4da4fb0d
|
3 |
+
size 46958191
|
cumulus.jpg
ADDED
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|