changes
Browse files- app.py +10 -4
- bear_classifier.ipynb +0 -0
- images/grizzly.jpg +0 -0
- model.pkl +3 -0
- model.pklZone.Identifier +0 -0
- requirements.txt +2 -0
app.py
CHANGED
@@ -1,9 +1,15 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
|
|
3 |
|
4 |
-
|
5 |
-
return "Hello " + name + "!!"
|
6 |
|
7 |
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
4 |
+
learn = load_learner('model.pkl')
|
5 |
|
6 |
+
labels = learn.dls.vocab
|
|
|
7 |
|
8 |
|
9 |
+
def predict(img):
|
10 |
+
img = PILImage.create(img)
|
11 |
+
pred, pred_idx, probs = learn.predict(img)
|
12 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
13 |
+
|
14 |
+
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)),
|
15 |
+
outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
|
bear_classifier.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
images/grizzly.jpg
ADDED
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:482059b84e3b71c60f5b9ffc6b1d13ddaefe98ab76e1f942667d5325f362a311
|
3 |
+
size 46967509
|
model.pklZone.Identifier
ADDED
File without changes
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|