tanmaykm commited on
Commit
fdc6749
1 Parent(s): e64440f

export missing function

Browse files
Files changed (2) hide show
  1. app.ipynb +9 -83
  2. app.py +8 -1
app.ipynb CHANGED
@@ -54,7 +54,7 @@
54
  },
55
  {
56
  "cell_type": "code",
57
- "execution_count": 4,
58
  "id": "04067853-7c15-4d1e-97e1-492bbf673e95",
59
  "metadata": {
60
  "tags": []
@@ -67,7 +67,7 @@
67
  },
68
  {
69
  "cell_type": "code",
70
- "execution_count": 5,
71
  "id": "e509f89e-afaf-4113-b306-2c87ba47b3f5",
72
  "metadata": {
73
  "tags": []
@@ -127,7 +127,7 @@
127
  " 9.5897e-01, 1.0382e-05]))"
128
  ]
129
  },
130
- "execution_count": 5,
131
  "metadata": {},
132
  "output_type": "execute_result"
133
  }
@@ -138,14 +138,14 @@
138
  },
139
  {
140
  "cell_type": "code",
141
- "execution_count": 6,
142
  "id": "dce7eb50-5d6c-49ff-af40-38661c5a4382",
143
  "metadata": {
144
  "tags": []
145
  },
146
  "outputs": [],
147
  "source": [
148
- "#!export\n",
149
  "categories = learn.dls.vocab\n",
150
  "\n",
151
  "def classify_dance(img):\n",
@@ -155,7 +155,7 @@
155
  },
156
  {
157
  "cell_type": "code",
158
- "execution_count": 7,
159
  "id": "9ac8e22b-fc1c-4c70-887a-c28ad297563d",
160
  "metadata": {
161
  "tags": []
@@ -211,7 +211,7 @@
211
  " 'sattriya': 1.0382239452155773e-05}"
212
  ]
213
  },
214
- "execution_count": 7,
215
  "metadata": {},
216
  "output_type": "execute_result"
217
  }
@@ -222,7 +222,7 @@
222
  },
223
  {
224
  "cell_type": "code",
225
- "execution_count": 8,
226
  "id": "68faa281-c721-407a-87f5-dcdfce9cf55a",
227
  "metadata": {
228
  "tags": []
@@ -255,7 +255,7 @@
255
  "data": {
256
  "text/plain": []
257
  },
258
- "execution_count": 8,
259
  "metadata": {},
260
  "output_type": "execute_result"
261
  },
@@ -286,80 +286,6 @@
286
  "metadata": {},
287
  "output_type": "display_data"
288
  },
289
- {
290
- "data": {
291
- "text/html": [],
292
- "text/plain": [
293
- "<IPython.core.display.HTML object>"
294
- ]
295
- },
296
- "metadata": {},
297
- "output_type": "display_data"
298
- },
299
- {
300
- "data": {
301
- "text/html": [
302
- "\n",
303
- "<style>\n",
304
- " /* Turns off some styling */\n",
305
- " progress {\n",
306
- " /* gets rid of default border in Firefox and Opera. */\n",
307
- " border: none;\n",
308
- " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
309
- " background-size: auto;\n",
310
- " }\n",
311
- " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
312
- " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
313
- " }\n",
314
- " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
315
- " background: #F44336;\n",
316
- " }\n",
317
- "</style>\n"
318
- ],
319
- "text/plain": [
320
- "<IPython.core.display.HTML object>"
321
- ]
322
- },
323
- "metadata": {},
324
- "output_type": "display_data"
325
- },
326
- {
327
- "data": {
328
- "text/html": [],
329
- "text/plain": [
330
- "<IPython.core.display.HTML object>"
331
- ]
332
- },
333
- "metadata": {},
334
- "output_type": "display_data"
335
- },
336
- {
337
- "data": {
338
- "text/html": [
339
- "\n",
340
- "<style>\n",
341
- " /* Turns off some styling */\n",
342
- " progress {\n",
343
- " /* gets rid of default border in Firefox and Opera. */\n",
344
- " border: none;\n",
345
- " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
346
- " background-size: auto;\n",
347
- " }\n",
348
- " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
349
- " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
350
- " }\n",
351
- " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
352
- " background: #F44336;\n",
353
- " }\n",
354
- "</style>\n"
355
- ],
356
- "text/plain": [
357
- "<IPython.core.display.HTML object>"
358
- ]
359
- },
360
- "metadata": {},
361
- "output_type": "display_data"
362
- },
363
  {
364
  "data": {
365
  "text/html": [],
 
54
  },
55
  {
56
  "cell_type": "code",
57
+ "execution_count": 5,
58
  "id": "04067853-7c15-4d1e-97e1-492bbf673e95",
59
  "metadata": {
60
  "tags": []
 
67
  },
68
  {
69
  "cell_type": "code",
70
+ "execution_count": 6,
71
  "id": "e509f89e-afaf-4113-b306-2c87ba47b3f5",
72
  "metadata": {
73
  "tags": []
 
127
  " 9.5897e-01, 1.0382e-05]))"
128
  ]
129
  },
130
+ "execution_count": 6,
131
  "metadata": {},
132
  "output_type": "execute_result"
133
  }
 
138
  },
139
  {
140
  "cell_type": "code",
141
+ "execution_count": 7,
142
  "id": "dce7eb50-5d6c-49ff-af40-38661c5a4382",
143
  "metadata": {
144
  "tags": []
145
  },
146
  "outputs": [],
147
  "source": [
148
+ "#|export\n",
149
  "categories = learn.dls.vocab\n",
150
  "\n",
151
  "def classify_dance(img):\n",
 
155
  },
156
  {
157
  "cell_type": "code",
158
+ "execution_count": 8,
159
  "id": "9ac8e22b-fc1c-4c70-887a-c28ad297563d",
160
  "metadata": {
161
  "tags": []
 
211
  " 'sattriya': 1.0382239452155773e-05}"
212
  ]
213
  },
214
+ "execution_count": 8,
215
  "metadata": {},
216
  "output_type": "execute_result"
217
  }
 
222
  },
223
  {
224
  "cell_type": "code",
225
+ "execution_count": 9,
226
  "id": "68faa281-c721-407a-87f5-dcdfce9cf55a",
227
  "metadata": {
228
  "tags": []
 
255
  "data": {
256
  "text/plain": []
257
  },
258
+ "execution_count": 9,
259
  "metadata": {},
260
  "output_type": "execute_result"
261
  },
 
286
  "metadata": {},
287
  "output_type": "display_data"
288
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
  {
290
  "data": {
291
  "text/html": [],
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']
5
 
6
  # %% app.ipynb 1
7
  from fastai.vision.all import *
@@ -10,6 +10,13 @@ import gradio as gr
10
  # %% app.ipynb 3
11
  learn = load_learner('model/indian_dance_forms_resnet50.pkl')
12
 
 
 
 
 
 
 
 
13
  # %% app.ipynb 7
14
  image = gr.inputs.Image(shape=(192,192))
15
  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', 'classify_dance']
5
 
6
  # %% app.ipynb 1
7
  from fastai.vision.all import *
 
10
  # %% app.ipynb 3
11
  learn = load_learner('model/indian_dance_forms_resnet50.pkl')
12
 
13
+ # %% app.ipynb 5
14
+ categories = learn.dls.vocab
15
+
16
+ def classify_dance(img):
17
+ pred,idx,probs = learn.predict(img)
18
+ return dict(zip(categories, map(float,probs)))
19
+
20
  # %% app.ipynb 7
21
  image = gr.inputs.Image(shape=(192,192))
22
  label = gr.outputs.Label()