Spaces:
Runtime error
Runtime error
Alexei Smith
commited on
Commit
β’
431b18b
1
Parent(s):
840be59
Move app.py to root
Browse files- app.ipynb +16 -23
- app/app.py β app.py +5 -5
app.ipynb
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
-
"execution_count":
|
6 |
"metadata": {},
|
7 |
"outputs": [],
|
8 |
"source": [
|
@@ -11,7 +11,7 @@
|
|
11 |
},
|
12 |
{
|
13 |
"cell_type": "code",
|
14 |
-
"execution_count":
|
15 |
"metadata": {},
|
16 |
"outputs": [],
|
17 |
"source": [
|
@@ -30,7 +30,7 @@
|
|
30 |
},
|
31 |
{
|
32 |
"cell_type": "code",
|
33 |
-
"execution_count":
|
34 |
"metadata": {},
|
35 |
"outputs": [],
|
36 |
"source": [
|
@@ -41,7 +41,7 @@
|
|
41 |
},
|
42 |
{
|
43 |
"cell_type": "code",
|
44 |
-
"execution_count":
|
45 |
"metadata": {},
|
46 |
"outputs": [
|
47 |
{
|
@@ -52,7 +52,7 @@
|
|
52 |
"PILImage mode=RGB size=192x128"
|
53 |
]
|
54 |
},
|
55 |
-
"execution_count":
|
56 |
"metadata": {},
|
57 |
"output_type": "execute_result"
|
58 |
}
|
@@ -65,7 +65,7 @@
|
|
65 |
},
|
66 |
{
|
67 |
"cell_type": "code",
|
68 |
-
"execution_count":
|
69 |
"metadata": {},
|
70 |
"outputs": [],
|
71 |
"source": [
|
@@ -75,7 +75,7 @@
|
|
75 |
},
|
76 |
{
|
77 |
"cell_type": "code",
|
78 |
-
"execution_count":
|
79 |
"metadata": {},
|
80 |
"outputs": [
|
81 |
{
|
@@ -121,7 +121,7 @@
|
|
121 |
"('gym', tensor(0), tensor([1.0000e+00, 6.7478e-07]))"
|
122 |
]
|
123 |
},
|
124 |
-
"execution_count":
|
125 |
"metadata": {},
|
126 |
"output_type": "execute_result"
|
127 |
}
|
@@ -132,7 +132,7 @@
|
|
132 |
},
|
133 |
{
|
134 |
"cell_type": "code",
|
135 |
-
"execution_count":
|
136 |
"metadata": {},
|
137 |
"outputs": [],
|
138 |
"source": [
|
@@ -146,7 +146,7 @@
|
|
146 |
},
|
147 |
{
|
148 |
"cell_type": "code",
|
149 |
-
"execution_count":
|
150 |
"metadata": {},
|
151 |
"outputs": [
|
152 |
{
|
@@ -192,7 +192,7 @@
|
|
192 |
"{'Gym Ryan': 0.9999992847442627, 'Jim Ryan': 6.747773682036495e-07}"
|
193 |
]
|
194 |
},
|
195 |
-
"execution_count":
|
196 |
"metadata": {},
|
197 |
"output_type": "execute_result"
|
198 |
}
|
@@ -203,7 +203,7 @@
|
|
203 |
},
|
204 |
{
|
205 |
"cell_type": "code",
|
206 |
-
"execution_count":
|
207 |
"metadata": {},
|
208 |
"outputs": [
|
209 |
{
|
@@ -224,7 +224,7 @@
|
|
224 |
"name": "stdout",
|
225 |
"output_type": "stream",
|
226 |
"text": [
|
227 |
-
"Running on local URL: http://127.0.0.1:
|
228 |
"\n",
|
229 |
"To create a public link, set `share=True` in `launch()`.\n"
|
230 |
]
|
@@ -233,7 +233,7 @@
|
|
233 |
"data": {
|
234 |
"text/plain": []
|
235 |
},
|
236 |
-
"execution_count":
|
237 |
"metadata": {},
|
238 |
"output_type": "execute_result"
|
239 |
}
|
@@ -257,21 +257,14 @@
|
|
257 |
},
|
258 |
{
|
259 |
"cell_type": "code",
|
260 |
-
"execution_count":
|
261 |
"metadata": {},
|
262 |
"outputs": [],
|
263 |
"source": [
|
264 |
"# run pip install nbdev on local venv before running this\n",
|
265 |
"import nbdev\n",
|
266 |
-
"nbdev.export.nb_export('app.ipynb', '
|
267 |
]
|
268 |
-
},
|
269 |
-
{
|
270 |
-
"cell_type": "code",
|
271 |
-
"execution_count": null,
|
272 |
-
"metadata": {},
|
273 |
-
"outputs": [],
|
274 |
-
"source": []
|
275 |
}
|
276 |
],
|
277 |
"metadata": {
|
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
+
"execution_count": 124,
|
6 |
"metadata": {},
|
7 |
"outputs": [],
|
8 |
"source": [
|
|
|
11 |
},
|
12 |
{
|
13 |
"cell_type": "code",
|
14 |
+
"execution_count": 125,
|
15 |
"metadata": {},
|
16 |
"outputs": [],
|
17 |
"source": [
|
|
|
30 |
},
|
31 |
{
|
32 |
"cell_type": "code",
|
33 |
+
"execution_count": 126,
|
34 |
"metadata": {},
|
35 |
"outputs": [],
|
36 |
"source": [
|
|
|
41 |
},
|
42 |
{
|
43 |
"cell_type": "code",
|
44 |
+
"execution_count": 127,
|
45 |
"metadata": {},
|
46 |
"outputs": [
|
47 |
{
|
|
|
52 |
"PILImage mode=RGB size=192x128"
|
53 |
]
|
54 |
},
|
55 |
+
"execution_count": 127,
|
56 |
"metadata": {},
|
57 |
"output_type": "execute_result"
|
58 |
}
|
|
|
65 |
},
|
66 |
{
|
67 |
"cell_type": "code",
|
68 |
+
"execution_count": 128,
|
69 |
"metadata": {},
|
70 |
"outputs": [],
|
71 |
"source": [
|
|
|
75 |
},
|
76 |
{
|
77 |
"cell_type": "code",
|
78 |
+
"execution_count": 129,
|
79 |
"metadata": {},
|
80 |
"outputs": [
|
81 |
{
|
|
|
121 |
"('gym', tensor(0), tensor([1.0000e+00, 6.7478e-07]))"
|
122 |
]
|
123 |
},
|
124 |
+
"execution_count": 129,
|
125 |
"metadata": {},
|
126 |
"output_type": "execute_result"
|
127 |
}
|
|
|
132 |
},
|
133 |
{
|
134 |
"cell_type": "code",
|
135 |
+
"execution_count": 130,
|
136 |
"metadata": {},
|
137 |
"outputs": [],
|
138 |
"source": [
|
|
|
146 |
},
|
147 |
{
|
148 |
"cell_type": "code",
|
149 |
+
"execution_count": 131,
|
150 |
"metadata": {},
|
151 |
"outputs": [
|
152 |
{
|
|
|
192 |
"{'Gym Ryan': 0.9999992847442627, 'Jim Ryan': 6.747773682036495e-07}"
|
193 |
]
|
194 |
},
|
195 |
+
"execution_count": 131,
|
196 |
"metadata": {},
|
197 |
"output_type": "execute_result"
|
198 |
}
|
|
|
203 |
},
|
204 |
{
|
205 |
"cell_type": "code",
|
206 |
+
"execution_count": 132,
|
207 |
"metadata": {},
|
208 |
"outputs": [
|
209 |
{
|
|
|
224 |
"name": "stdout",
|
225 |
"output_type": "stream",
|
226 |
"text": [
|
227 |
+
"Running on local URL: http://127.0.0.1:7865\n",
|
228 |
"\n",
|
229 |
"To create a public link, set `share=True` in `launch()`.\n"
|
230 |
]
|
|
|
233 |
"data": {
|
234 |
"text/plain": []
|
235 |
},
|
236 |
+
"execution_count": 132,
|
237 |
"metadata": {},
|
238 |
"output_type": "execute_result"
|
239 |
}
|
|
|
257 |
},
|
258 |
{
|
259 |
"cell_type": "code",
|
260 |
+
"execution_count": 133,
|
261 |
"metadata": {},
|
262 |
"outputs": [],
|
263 |
"source": [
|
264 |
"# run pip install nbdev on local venv before running this\n",
|
265 |
"import nbdev\n",
|
266 |
+
"nbdev.export.nb_export('app.ipynb', '.')"
|
267 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
}
|
269 |
],
|
270 |
"metadata": {
|
app/app.py β app.py
RENAMED
@@ -1,23 +1,23 @@
|
|
1 |
-
# AUTOGENERATED! DO NOT EDIT! File to edit:
|
2 |
|
3 |
# %% auto 0
|
4 |
__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']
|
5 |
|
6 |
-
# %%
|
7 |
from fastai.vision.all import *
|
8 |
import gradio as gr
|
9 |
|
10 |
-
# %%
|
11 |
learn = load_learner('model.pkl')
|
12 |
|
13 |
-
# %%
|
14 |
categories = ('Gym Ryan', 'Jim Ryan')
|
15 |
|
16 |
def classify_image(img):
|
17 |
pred,idx,probs = learn.predict(img)
|
18 |
return dict(zip(categories, map(float,probs)))
|
19 |
|
20 |
-
# %%
|
21 |
image = gr.inputs.Image(shape=(192,192))
|
22 |
label = gr.outputs.Label()
|
23 |
examples = ['images/jim1.jpg',
|
|
|
1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
|
2 |
|
3 |
# %% auto 0
|
4 |
__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']
|
5 |
|
6 |
+
# %% app.ipynb 1
|
7 |
from fastai.vision.all import *
|
8 |
import gradio as gr
|
9 |
|
10 |
+
# %% app.ipynb 5
|
11 |
learn = load_learner('model.pkl')
|
12 |
|
13 |
+
# %% app.ipynb 7
|
14 |
categories = ('Gym Ryan', 'Jim Ryan')
|
15 |
|
16 |
def classify_image(img):
|
17 |
pred,idx,probs = learn.predict(img)
|
18 |
return dict(zip(categories, map(float,probs)))
|
19 |
|
20 |
+
# %% app.ipynb 9
|
21 |
image = gr.inputs.Image(shape=(192,192))
|
22 |
label = gr.outputs.Label()
|
23 |
examples = ['images/jim1.jpg',
|