Spaces:
Sleeping
Sleeping
Donald Kapyouo
commited on
Commit
·
1f08ab2
1
Parent(s):
4c3e12e
update code
Browse files- app.py +5 -5
- requirements.txt +1 -2
app.py
CHANGED
@@ -3,15 +3,15 @@ from fastai.vision.all import *
|
|
3 |
|
4 |
def is_cat(x): return x[0].isupper()
|
5 |
|
6 |
-
learn = load_learner('
|
7 |
|
8 |
-
categories = ['
|
9 |
|
10 |
def predict_image(img):
|
11 |
pred, pred_idx, probs = learn.predict(img)
|
12 |
return dict(zip(categories, map(float, probs)))
|
13 |
|
14 |
-
image = gr.
|
15 |
-
label = gr.
|
16 |
examples = ["cat.jpg", "dog.jpg"]
|
17 |
-
gr.Interface(fn=predict_image, inputs=image, outputs=label
|
|
|
3 |
|
4 |
def is_cat(x): return x[0].isupper()
|
5 |
|
6 |
+
learn = load_learner('model2.pkl')
|
7 |
|
8 |
+
categories = ['dog', 'cat']
|
9 |
|
10 |
def predict_image(img):
|
11 |
pred, pred_idx, probs = learn.predict(img)
|
12 |
return dict(zip(categories, map(float, probs)))
|
13 |
|
14 |
+
image = gr.Image()
|
15 |
+
label = gr.Label()
|
16 |
examples = ["cat.jpg", "dog.jpg"]
|
17 |
+
gr.Interface(fn=predict_image, inputs=image, outputs=label).launch()
|
requirements.txt
CHANGED
@@ -1,2 +1 @@
|
|
1 |
-
fastai
|
2 |
-
gradio
|
|
|
1 |
+
fastai
|
|