update 2
Browse files- app.ipynb +17 -31
- app.py +4 -8
- settings.ini +75 -0
app.ipynb
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
-
"execution_count":
|
6 |
"id": "dcad9070",
|
7 |
"metadata": {},
|
8 |
"outputs": [],
|
@@ -12,18 +12,19 @@
|
|
12 |
},
|
13 |
{
|
14 |
"cell_type": "code",
|
15 |
-
"execution_count":
|
16 |
"id": "b0d51b0e",
|
17 |
"metadata": {},
|
18 |
"outputs": [],
|
19 |
"source": [
|
|
|
20 |
"from fastai.vision.all import *\n",
|
21 |
"import gradio as gr"
|
22 |
]
|
23 |
},
|
24 |
{
|
25 |
"cell_type": "code",
|
26 |
-
"execution_count":
|
27 |
"id": "0253652f",
|
28 |
"metadata": {},
|
29 |
"outputs": [
|
@@ -34,7 +35,7 @@
|
|
34 |
"PILImage mode=RGB size=192x128"
|
35 |
]
|
36 |
},
|
37 |
-
"execution_count":
|
38 |
"metadata": {},
|
39 |
"output_type": "execute_result"
|
40 |
}
|
@@ -47,7 +48,7 @@
|
|
47 |
},
|
48 |
{
|
49 |
"cell_type": "code",
|
50 |
-
"execution_count":
|
51 |
"id": "daa84358",
|
52 |
"metadata": {},
|
53 |
"outputs": [],
|
@@ -58,7 +59,7 @@
|
|
58 |
},
|
59 |
{
|
60 |
"cell_type": "code",
|
61 |
-
"execution_count":
|
62 |
"id": "11d1aebe",
|
63 |
"metadata": {},
|
64 |
"outputs": [],
|
@@ -73,7 +74,7 @@
|
|
73 |
},
|
74 |
{
|
75 |
"cell_type": "code",
|
76 |
-
"execution_count":
|
77 |
"id": "3a193e0a",
|
78 |
"metadata": {},
|
79 |
"outputs": [
|
@@ -122,7 +123,7 @@
|
|
122 |
" 'person barbell squatting': 0.0345771498978138}"
|
123 |
]
|
124 |
},
|
125 |
-
"execution_count":
|
126 |
"metadata": {},
|
127 |
"output_type": "execute_result"
|
128 |
}
|
@@ -133,7 +134,7 @@
|
|
133 |
},
|
134 |
{
|
135 |
"cell_type": "code",
|
136 |
-
"execution_count":
|
137 |
"id": "2789ad64",
|
138 |
"metadata": {},
|
139 |
"outputs": [
|
@@ -141,7 +142,7 @@
|
|
141 |
"name": "stdout",
|
142 |
"output_type": "stream",
|
143 |
"text": [
|
144 |
-
"Running on local URL: http://127.0.0.1:
|
145 |
"\n",
|
146 |
"To create a public link, set `share=True` in `launch()`.\n"
|
147 |
]
|
@@ -149,12 +150,12 @@
|
|
149 |
{
|
150 |
"data": {
|
151 |
"text/plain": [
|
152 |
-
"(<fastapi.applications.FastAPI at
|
153 |
-
" 'http://127.0.0.1:
|
154 |
" None)"
|
155 |
]
|
156 |
},
|
157 |
-
"execution_count":
|
158 |
"metadata": {},
|
159 |
"output_type": "execute_result"
|
160 |
}
|
@@ -171,7 +172,7 @@
|
|
171 |
},
|
172 |
{
|
173 |
"cell_type": "code",
|
174 |
-
"execution_count":
|
175 |
"id": "06dd273a",
|
176 |
"metadata": {},
|
177 |
"outputs": [],
|
@@ -182,25 +183,10 @@
|
|
182 |
},
|
183 |
{
|
184 |
"cell_type": "code",
|
185 |
-
"execution_count":
|
186 |
"id": "fe3628e5",
|
187 |
"metadata": {},
|
188 |
-
"outputs": [
|
189 |
-
{
|
190 |
-
"ename": "FileNotFoundError",
|
191 |
-
"evalue": "[Errno 2] No such file or directory: '/mnt/z/Documents1/Repositories/exercise_classifier/{lib_name}/_nbdev.py'",
|
192 |
-
"output_type": "error",
|
193 |
-
"traceback": [
|
194 |
-
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
195 |
-
"\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
|
196 |
-
"\u001b[1;32m/mnt/z/Documents1/Repositories/exercise_classifier/app.ipynb Cell 9'\u001b[0m in \u001b[0;36m<cell line: 1>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> <a href='vscode-notebook-cell://wsl%2Bubuntu-20.04/mnt/z/Documents1/Repositories/exercise_classifier/app.ipynb#ch0000008vscode-remote?line=0'>1</a>\u001b[0m notebook2script(\u001b[39m'\u001b[39;49m\u001b[39mapp.ipynb\u001b[39;49m\u001b[39m'\u001b[39;49m)\n",
|
197 |
-
"File \u001b[0;32m~/mambaforge/lib/python3.9/site-packages/nbdev/export.py:441\u001b[0m, in \u001b[0;36mnotebook2script\u001b[0;34m(fname, silent, to_dict, bare)\u001b[0m\n\u001b[1;32m <a href='file:///home/zac-ubuntu-wsl/mambaforge/lib/python3.9/site-packages/nbdev/export.py?line=438'>439</a>\u001b[0m d \u001b[39m=\u001b[39m collections\u001b[39m.\u001b[39mdefaultdict(\u001b[39mlist\u001b[39m) \u001b[39mif\u001b[39;00m to_dict \u001b[39melse\u001b[39;00m \u001b[39mNone\u001b[39;00m\n\u001b[1;32m <a href='file:///home/zac-ubuntu-wsl/mambaforge/lib/python3.9/site-packages/nbdev/export.py?line=439'>440</a>\u001b[0m modules \u001b[39m=\u001b[39m create_mod_files(files, to_dict, bare\u001b[39m=\u001b[39mbare)\n\u001b[0;32m--> <a href='file:///home/zac-ubuntu-wsl/mambaforge/lib/python3.9/site-packages/nbdev/export.py?line=440'>441</a>\u001b[0m \u001b[39mfor\u001b[39;00m f \u001b[39min\u001b[39;00m \u001b[39msorted\u001b[39m(files): d \u001b[39m=\u001b[39m _notebook2script(f, modules, silent\u001b[39m=\u001b[39;49msilent, to_dict\u001b[39m=\u001b[39;49md, bare\u001b[39m=\u001b[39;49mbare)\n\u001b[1;32m <a href='file:///home/zac-ubuntu-wsl/mambaforge/lib/python3.9/site-packages/nbdev/export.py?line=441'>442</a>\u001b[0m \u001b[39mif\u001b[39;00m to_dict: \u001b[39mreturn\u001b[39;00m d\n\u001b[1;32m <a href='file:///home/zac-ubuntu-wsl/mambaforge/lib/python3.9/site-packages/nbdev/export.py?line=442'>443</a>\u001b[0m \u001b[39melif\u001b[39;00m fname \u001b[39mis\u001b[39;00m \u001b[39mNone\u001b[39;00m: add_init(get_config()\u001b[39m.\u001b[39mpath(\u001b[39m\"\u001b[39m\u001b[39mlib_path\u001b[39m\u001b[39m\"\u001b[39m))\n",
|
198 |
-
"File \u001b[0;32m~/mambaforge/lib/python3.9/site-packages/nbdev/export.py:376\u001b[0m, in \u001b[0;36m_notebook2script\u001b[0;34m(fname, modules, silent, to_dict, bare)\u001b[0m\n\u001b[1;32m <a href='file:///home/zac-ubuntu-wsl/mambaforge/lib/python3.9/site-packages/nbdev/export.py?line=373'>374</a>\u001b[0m \u001b[39mwith\u001b[39;00m \u001b[39mopen\u001b[39m(fname_out, \u001b[39m'\u001b[39m\u001b[39ma\u001b[39m\u001b[39m'\u001b[39m, encoding\u001b[39m=\u001b[39m\u001b[39m'\u001b[39m\u001b[39mutf8\u001b[39m\u001b[39m'\u001b[39m) \u001b[39mas\u001b[39;00m f: f\u001b[39m.\u001b[39mwrite(code)\n\u001b[1;32m <a href='file:///home/zac-ubuntu-wsl/mambaforge/lib/python3.9/site-packages/nbdev/export.py?line=374'>375</a>\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mf\u001b[39m\u001b[39m'\u001b[39m\u001b[39m{\u001b[39;00me\u001b[39m}\u001b[39;00m\u001b[39m.py\u001b[39m\u001b[39m'\u001b[39m \u001b[39mnot\u001b[39;00m \u001b[39min\u001b[39;00m mod\u001b[39m.\u001b[39mmodules: mod\u001b[39m.\u001b[39mmodules\u001b[39m.\u001b[39mappend(\u001b[39mf\u001b[39m\u001b[39m'\u001b[39m\u001b[39m{\u001b[39;00me\u001b[39m}\u001b[39;00m\u001b[39m.py\u001b[39m\u001b[39m'\u001b[39m)\n\u001b[0;32m--> <a href='file:///home/zac-ubuntu-wsl/mambaforge/lib/python3.9/site-packages/nbdev/export.py?line=375'>376</a>\u001b[0m \u001b[39mif\u001b[39;00m has_setting: save_nbdev_module(mod)\n\u001b[1;32m <a href='file:///home/zac-ubuntu-wsl/mambaforge/lib/python3.9/site-packages/nbdev/export.py?line=377'>378</a>\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m silent: \u001b[39mprint\u001b[39m(\u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mConverted \u001b[39m\u001b[39m{\u001b[39;00mfname\u001b[39m.\u001b[39mname\u001b[39m}\u001b[39;00m\u001b[39m.\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m <a href='file:///home/zac-ubuntu-wsl/mambaforge/lib/python3.9/site-packages/nbdev/export.py?line=378'>379</a>\u001b[0m \u001b[39mreturn\u001b[39;00m to_dict\n",
|
199 |
-
"File \u001b[0;32m~/mambaforge/lib/python3.9/site-packages/nbdev/export.py:286\u001b[0m, in \u001b[0;36msave_nbdev_module\u001b[0;34m(mod)\u001b[0m\n\u001b[1;32m <a href='file:///home/zac-ubuntu-wsl/mambaforge/lib/python3.9/site-packages/nbdev/export.py?line=283'>284</a>\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mSave `mod` inside <code>_nbdev</code>\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m <a href='file:///home/zac-ubuntu-wsl/mambaforge/lib/python3.9/site-packages/nbdev/export.py?line=284'>285</a>\u001b[0m fname \u001b[39m=\u001b[39m get_config()\u001b[39m.\u001b[39mpath(\u001b[39m\"\u001b[39m\u001b[39mlib_path\u001b[39m\u001b[39m\"\u001b[39m)\u001b[39m/\u001b[39m\u001b[39m'\u001b[39m\u001b[39m_nbdev.py\u001b[39m\u001b[39m'\u001b[39m\n\u001b[0;32m--> <a href='file:///home/zac-ubuntu-wsl/mambaforge/lib/python3.9/site-packages/nbdev/export.py?line=285'>286</a>\u001b[0m \u001b[39mwith\u001b[39;00m \u001b[39mopen\u001b[39;49m(fname, \u001b[39m'\u001b[39;49m\u001b[39mr\u001b[39;49m\u001b[39m'\u001b[39;49m) \u001b[39mas\u001b[39;00m f: code \u001b[39m=\u001b[39m f\u001b[39m.\u001b[39mread()\n\u001b[1;32m <a href='file:///home/zac-ubuntu-wsl/mambaforge/lib/python3.9/site-packages/nbdev/export.py?line=286'>287</a>\u001b[0m t \u001b[39m=\u001b[39m \u001b[39mr\u001b[39m\u001b[39m'\u001b[39m\u001b[39m,\u001b[39m\u001b[39m\\\u001b[39m\u001b[39mn \u001b[39m\u001b[39m'\u001b[39m\u001b[39m.\u001b[39mjoin([\u001b[39mf\u001b[39m\u001b[39m'\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m{\u001b[39;00mk\u001b[39m}\u001b[39;00m\u001b[39m\"\u001b[39m\u001b[39m: \u001b[39m\u001b[39m\"\u001b[39m\u001b[39m{\u001b[39;00mv\u001b[39m}\u001b[39;00m\u001b[39m\"\u001b[39m\u001b[39m'\u001b[39m \u001b[39mfor\u001b[39;00m k,v \u001b[39min\u001b[39;00m mod\u001b[39m.\u001b[39mindex\u001b[39m.\u001b[39mitems()])\n\u001b[1;32m <a href='file:///home/zac-ubuntu-wsl/mambaforge/lib/python3.9/site-packages/nbdev/export.py?line=287'>288</a>\u001b[0m code \u001b[39m=\u001b[39m _re_index_idx\u001b[39m.\u001b[39msub(\u001b[39m\"\u001b[39m\u001b[39mindex = \u001b[39m\u001b[39m{\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m+\u001b[39m t \u001b[39m+\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m}\u001b[39m\u001b[39m\"\u001b[39m, code)\n",
|
200 |
-
"\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '/mnt/z/Documents1/Repositories/exercise_classifier/{lib_name}/_nbdev.py'"
|
201 |
-
]
|
202 |
-
}
|
203 |
-
],
|
204 |
"source": [
|
205 |
"notebook2script('app.pynb')"
|
206 |
]
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
+
"execution_count": 1,
|
6 |
"id": "dcad9070",
|
7 |
"metadata": {},
|
8 |
"outputs": [],
|
12 |
},
|
13 |
{
|
14 |
"cell_type": "code",
|
15 |
+
"execution_count": 2,
|
16 |
"id": "b0d51b0e",
|
17 |
"metadata": {},
|
18 |
"outputs": [],
|
19 |
"source": [
|
20 |
+
"#|export\n",
|
21 |
"from fastai.vision.all import *\n",
|
22 |
"import gradio as gr"
|
23 |
]
|
24 |
},
|
25 |
{
|
26 |
"cell_type": "code",
|
27 |
+
"execution_count": 3,
|
28 |
"id": "0253652f",
|
29 |
"metadata": {},
|
30 |
"outputs": [
|
35 |
"PILImage mode=RGB size=192x128"
|
36 |
]
|
37 |
},
|
38 |
+
"execution_count": 3,
|
39 |
"metadata": {},
|
40 |
"output_type": "execute_result"
|
41 |
}
|
48 |
},
|
49 |
{
|
50 |
"cell_type": "code",
|
51 |
+
"execution_count": 4,
|
52 |
"id": "daa84358",
|
53 |
"metadata": {},
|
54 |
"outputs": [],
|
59 |
},
|
60 |
{
|
61 |
"cell_type": "code",
|
62 |
+
"execution_count": 5,
|
63 |
"id": "11d1aebe",
|
64 |
"metadata": {},
|
65 |
"outputs": [],
|
74 |
},
|
75 |
{
|
76 |
"cell_type": "code",
|
77 |
+
"execution_count": 6,
|
78 |
"id": "3a193e0a",
|
79 |
"metadata": {},
|
80 |
"outputs": [
|
123 |
" 'person barbell squatting': 0.0345771498978138}"
|
124 |
]
|
125 |
},
|
126 |
+
"execution_count": 6,
|
127 |
"metadata": {},
|
128 |
"output_type": "execute_result"
|
129 |
}
|
134 |
},
|
135 |
{
|
136 |
"cell_type": "code",
|
137 |
+
"execution_count": 7,
|
138 |
"id": "2789ad64",
|
139 |
"metadata": {},
|
140 |
"outputs": [
|
142 |
"name": "stdout",
|
143 |
"output_type": "stream",
|
144 |
"text": [
|
145 |
+
"Running on local URL: http://127.0.0.1:7860/\n",
|
146 |
"\n",
|
147 |
"To create a public link, set `share=True` in `launch()`.\n"
|
148 |
]
|
150 |
{
|
151 |
"data": {
|
152 |
"text/plain": [
|
153 |
+
"(<fastapi.applications.FastAPI at 0x7f0f9e7aa0d0>,\n",
|
154 |
+
" 'http://127.0.0.1:7860/',\n",
|
155 |
" None)"
|
156 |
]
|
157 |
},
|
158 |
+
"execution_count": 7,
|
159 |
"metadata": {},
|
160 |
"output_type": "execute_result"
|
161 |
}
|
172 |
},
|
173 |
{
|
174 |
"cell_type": "code",
|
175 |
+
"execution_count": 8,
|
176 |
"id": "06dd273a",
|
177 |
"metadata": {},
|
178 |
"outputs": [],
|
183 |
},
|
184 |
{
|
185 |
"cell_type": "code",
|
186 |
+
"execution_count": 18,
|
187 |
"id": "fe3628e5",
|
188 |
"metadata": {},
|
189 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
"source": [
|
191 |
"notebook2script('app.pynb')"
|
192 |
]
|
app.py
CHANGED
@@ -1,18 +1,14 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
# Cell
|
6 |
learn = load_learner('model.pkl')
|
7 |
-
|
8 |
-
# Cell
|
9 |
categories = ('person bench pressing','person overhead pressing', 'person deadlifting', 'person lateral raising', 'person bent over row', 'person barbell squatting')
|
10 |
|
11 |
def classify_image(img):
|
12 |
pred,idx,probs = learn.predict(img)
|
13 |
return dict(zip(categories, map(float, probs)))
|
14 |
|
15 |
-
# Cell
|
16 |
image = gr.inputs.Image(shape=(192,192))
|
17 |
label = gr.outputs.Label()
|
18 |
examples = ['bench_press.jpg', 'deadlift.jpg', 'lateral_raise.jpg']
|
1 |
+
#|export
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import gradio as gr
|
|
|
|
|
4 |
learn = load_learner('model.pkl')
|
5 |
+
#|export
|
|
|
6 |
categories = ('person bench pressing','person overhead pressing', 'person deadlifting', 'person lateral raising', 'person bent over row', 'person barbell squatting')
|
7 |
|
8 |
def classify_image(img):
|
9 |
pred,idx,probs = learn.predict(img)
|
10 |
return dict(zip(categories, map(float, probs)))
|
11 |
|
|
|
12 |
image = gr.inputs.Image(shape=(192,192))
|
13 |
label = gr.outputs.Label()
|
14 |
examples = ['bench_press.jpg', 'deadlift.jpg', 'lateral_raise.jpg']
|
settings.ini
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[DEFAULT]
|
2 |
+
# All sections below are required unless otherwise specified
|
3 |
+
host = github
|
4 |
+
lib_name = {lib_name}
|
5 |
+
# For Enterprise Git add variable repo_name and company name
|
6 |
+
# repo_name = analytics
|
7 |
+
# company_name = nike
|
8 |
+
|
9 |
+
user = {user}
|
10 |
+
# description = A description of your project
|
11 |
+
# keywords = some keywords
|
12 |
+
author = {author}
|
13 |
+
author_email = {author_email}
|
14 |
+
# copyright = Put your copyright information here
|
15 |
+
branch = {branch}
|
16 |
+
version = 0.0.1
|
17 |
+
min_python = 3.6
|
18 |
+
audience = Developers
|
19 |
+
language = English
|
20 |
+
# Set to True if you want to create a more fancy sidebar.json than the default
|
21 |
+
custom_sidebar = False
|
22 |
+
# Add licenses and see current list in `setup.py`
|
23 |
+
license = apache2
|
24 |
+
# From 1-7: Planning Pre-Alpha Alpha Beta Production Mature Inactive
|
25 |
+
status = 2
|
26 |
+
|
27 |
+
# Optional. Same format as setuptools requirements
|
28 |
+
# requirements =
|
29 |
+
# Optional. Same format as setuptools console_scripts
|
30 |
+
# console_scripts =
|
31 |
+
# Optional. Same format as setuptools dependency-links
|
32 |
+
# dep_links =
|
33 |
+
|
34 |
+
###
|
35 |
+
# You probably won't need to change anything under here,
|
36 |
+
# unless you have some special requirements
|
37 |
+
###
|
38 |
+
|
39 |
+
# Change to, e.g. "nbs", to put your notebooks in nbs dir instead of repo root
|
40 |
+
nbs_path = .
|
41 |
+
doc_path = docs
|
42 |
+
|
43 |
+
# Whether to look for library notebooks recursively in the `nbs_path` dir
|
44 |
+
recursive = False
|
45 |
+
|
46 |
+
# Anything shown as '%(...)s' is substituted with that setting automatically
|
47 |
+
doc_host = https://%(user)s.github.io
|
48 |
+
#For Enterprise Git pages use:
|
49 |
+
#doc_host = https://pages.github.%(company_name)s.com.
|
50 |
+
|
51 |
+
|
52 |
+
doc_baseurl = /%(lib_name)s/
|
53 |
+
# For Enterprise Github pages docs use:
|
54 |
+
# doc_baseurl = /%(repo_name)s/%(lib_name)s/
|
55 |
+
|
56 |
+
git_url = https://github.com/%(user)s/%(lib_name)s/tree/%(branch)s/
|
57 |
+
# For Enterprise Github use:
|
58 |
+
#git_url = https://github.%(company_name)s.com/%(repo_name)s/%(lib_name)s/tree/%(branch)s/
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
lib_path = %(lib_name)s
|
63 |
+
title = %(lib_name)s
|
64 |
+
|
65 |
+
#Optional advanced parameters
|
66 |
+
#Monospace docstings: adds <pre> tags around the doc strings, preserving newlines/indentation.
|
67 |
+
#monospace_docstrings = False
|
68 |
+
#Test flags: introduce here the test flags you want to use separated by |
|
69 |
+
#tst_flags =
|
70 |
+
#Custom sidebar: customize sidebar.json yourself for advanced sidebars (False/True)
|
71 |
+
#custom_sidebar =
|
72 |
+
#Cell spacing: if you want cell blocks in code separated by more than one new line
|
73 |
+
#cell_spacing =
|
74 |
+
#Custom jekyll styles: if you want more jekyll styles than tip/important/warning, set them here
|
75 |
+
#jekyll_styles = note,warning,tip,important
|