Spaces:
Runtime error
Runtime error
clouds
Browse files- app.py +11 -9
- bong.jpeg +0 -3
- example_photos/altocumulus.jpg +0 -0
- example_photos/cirrocumulus.jpg +0 -0
- example_photos/lenticular.jpg +0 -0
- model.pkl +2 -2
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -2,21 +2,23 @@ from fastai.vision.all import *
|
|
| 2 |
import gradio as gr
|
| 3 |
import timm
|
| 4 |
|
| 5 |
-
|
| 6 |
-
learn = load_learner('model.pkl')
|
| 7 |
|
| 8 |
-
# Cell
|
| 9 |
categories = learn.dls.vocab
|
| 10 |
|
|
|
|
| 11 |
def classify_image(img):
|
| 12 |
-
pred,idx,probs = learn.predict(img)
|
| 13 |
-
return dict(zip(categories, map(float,probs)))
|
|
|
|
| 14 |
|
| 15 |
-
# Cell
|
| 16 |
image = gr.inputs.Image(shape=(192, 192))
|
| 17 |
label = gr.outputs.Label()
|
| 18 |
-
examples = [
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
# Cell
|
| 21 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 22 |
-
intf.launch()
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import timm
|
| 4 |
|
| 5 |
+
learn = load_learner("model.pkl")
|
|
|
|
| 6 |
|
|
|
|
| 7 |
categories = learn.dls.vocab
|
| 8 |
|
| 9 |
+
|
| 10 |
def classify_image(img):
|
| 11 |
+
pred, idx, probs = learn.predict(img)
|
| 12 |
+
return dict(zip(categories, map(float, probs)))
|
| 13 |
+
|
| 14 |
|
|
|
|
| 15 |
image = gr.inputs.Image(shape=(192, 192))
|
| 16 |
label = gr.outputs.Label()
|
| 17 |
+
examples = [
|
| 18 |
+
"example_photos/altocumulus.jpg",
|
| 19 |
+
"example_photos/lenticular.jpg",
|
| 20 |
+
"example_photos/cirrocumulus.jpg",
|
| 21 |
+
]
|
| 22 |
|
|
|
|
| 23 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 24 |
+
intf.launch()
|
bong.jpeg
DELETED
Git LFS Details
|
example_photos/altocumulus.jpg
ADDED
|
example_photos/cirrocumulus.jpg
ADDED
|
example_photos/lenticular.jpg
ADDED
|
model.pkl
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:34c77e03abb5cedec651ff4ad94a81657c6a5195f07754979b4282e7cd7caee8
|
| 3 |
+
size 46961485
|
requirements.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
fastai==2.7.12
|
| 2 |
-
gradio==3.
|
| 3 |
timm==0.9.2
|
| 4 |
torch==2.0.1
|
| 5 |
torchvision==0.15.2
|
|
|
|
| 1 |
fastai==2.7.12
|
| 2 |
+
gradio==3.37.0
|
| 3 |
timm==0.9.2
|
| 4 |
torch==2.0.1
|
| 5 |
torchvision==0.15.2
|