first version of classifier
Browse files- app.py +14 -0
- model/cat_dog_classifier.pkl +3 -0
- requirements.txt +1 -0
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
|
5 |
+
def predict(img):
|
6 |
+
img = PILImage.create(img)
|
7 |
+
pred, pred_idx, probs = learn_inf.predict(img)
|
8 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
9 |
+
|
10 |
+
|
11 |
+
learn_inf = load_learner('model/cat_dog_classifer.pkl')
|
12 |
+
labels = learn_inf.dls.vocab
|
13 |
+
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(224, 224)),
|
14 |
+
outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
|
model/cat_dog_classifier.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8e56f957ab5677bc43287f8d04817c5d568fabbe799425bb0ceee977dba88902
|
3 |
+
size 46965370
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fastai
|