Spaces:
Sleeping
Sleeping
Ajit Singh
commited on
Commit
•
296a883
1
Parent(s):
4709678
Add missing function classify_image
Browse files- .ipynb_checkpoints/app-checkpoint.ipynb +10 -1
- app.ipynb +2 -1
- app.py +7 -1
.ipynb_checkpoints/app-checkpoint.ipynb
CHANGED
@@ -573,6 +573,7 @@
|
|
573 |
"metadata": {},
|
574 |
"outputs": [],
|
575 |
"source": [
|
|
|
576 |
"categories = ('Dog', 'Cat')\n",
|
577 |
"def classify_image(img):\n",
|
578 |
" pref,idx,probs = learn.predict(img)\n",
|
@@ -716,13 +717,21 @@
|
|
716 |
},
|
717 |
{
|
718 |
"cell_type": "code",
|
719 |
-
"execution_count":
|
720 |
"id": "5e35eaab",
|
721 |
"metadata": {},
|
722 |
"outputs": [],
|
723 |
"source": [
|
724 |
"nbdev.export.nb_export('app.ipynb', '.')"
|
725 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
726 |
}
|
727 |
],
|
728 |
"metadata": {
|
|
|
573 |
"metadata": {},
|
574 |
"outputs": [],
|
575 |
"source": [
|
576 |
+
"#|export\n",
|
577 |
"categories = ('Dog', 'Cat')\n",
|
578 |
"def classify_image(img):\n",
|
579 |
" pref,idx,probs = learn.predict(img)\n",
|
|
|
717 |
},
|
718 |
{
|
719 |
"cell_type": "code",
|
720 |
+
"execution_count": 77,
|
721 |
"id": "5e35eaab",
|
722 |
"metadata": {},
|
723 |
"outputs": [],
|
724 |
"source": [
|
725 |
"nbdev.export.nb_export('app.ipynb', '.')"
|
726 |
]
|
727 |
+
},
|
728 |
+
{
|
729 |
+
"cell_type": "code",
|
730 |
+
"execution_count": null,
|
731 |
+
"id": "7f0bd0f2",
|
732 |
+
"metadata": {},
|
733 |
+
"outputs": [],
|
734 |
+
"source": []
|
735 |
}
|
736 |
],
|
737 |
"metadata": {
|
app.ipynb
CHANGED
@@ -573,6 +573,7 @@
|
|
573 |
"metadata": {},
|
574 |
"outputs": [],
|
575 |
"source": [
|
|
|
576 |
"categories = ('Dog', 'Cat')\n",
|
577 |
"def classify_image(img):\n",
|
578 |
" pref,idx,probs = learn.predict(img)\n",
|
@@ -727,7 +728,7 @@
|
|
727 |
{
|
728 |
"cell_type": "code",
|
729 |
"execution_count": null,
|
730 |
-
"id": "
|
731 |
"metadata": {},
|
732 |
"outputs": [],
|
733 |
"source": []
|
|
|
573 |
"metadata": {},
|
574 |
"outputs": [],
|
575 |
"source": [
|
576 |
+
"#|export\n",
|
577 |
"categories = ('Dog', 'Cat')\n",
|
578 |
"def classify_image(img):\n",
|
579 |
" pref,idx,probs = learn.predict(img)\n",
|
|
|
728 |
{
|
729 |
"cell_type": "code",
|
730 |
"execution_count": null,
|
731 |
+
"id": "7f0bd0f2",
|
732 |
"metadata": {},
|
733 |
"outputs": [],
|
734 |
"source": []
|
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
|
2 |
|
3 |
# %% auto 0
|
4 |
-
__all__ = ['learn', 'image', 'label', 'examples', 'intf', 'is_cat']
|
5 |
|
6 |
# %% app.ipynb 2
|
7 |
import fastbook
|
@@ -21,6 +21,12 @@ def is_cat(x): return x[0].issuper()
|
|
21 |
# %% app.ipynb 11
|
22 |
learn = load_learner('model.pkl')
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
# %% app.ipynb 16
|
25 |
image = gr.inputs.Image(shape=(192,192))
|
26 |
label = gr.outputs.Label()
|
|
|
1 |
# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
|
2 |
|
3 |
# %% auto 0
|
4 |
+
__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'is_cat', 'classify_image']
|
5 |
|
6 |
# %% app.ipynb 2
|
7 |
import fastbook
|
|
|
21 |
# %% app.ipynb 11
|
22 |
learn = load_learner('model.pkl')
|
23 |
|
24 |
+
# %% app.ipynb 13
|
25 |
+
categories = ('Dog', 'Cat')
|
26 |
+
def classify_image(img):
|
27 |
+
pref,idx,probs = learn.predict(img)
|
28 |
+
return dict(zip(categories, map(float, probs)))
|
29 |
+
|
30 |
# %% app.ipynb 16
|
31 |
image = gr.inputs.Image(shape=(192,192))
|
32 |
label = gr.outputs.Label()
|