Héctor Tarrido-Picart commited on
Commit
6719ca3
·
1 Parent(s): 5e5f3ef

fix runtime error

Browse files
Files changed (2) hide show
  1. app.py +12 -2
  2. powerline app.ipynb +31 -22
app.py CHANGED
@@ -1,5 +1,6 @@
1
  from fastai.vision.all import *
2
  import gradio as gr
 
3
 
4
  learn = load_learner('model.pkl')
5
 
@@ -14,9 +15,18 @@ images = gr.inputs.Image(shape=(512, 512))
14
  labels = gr.outputs.Label()
15
  examples = ['powerline_down.jpg', 'powerline_tree.jpg']
16
 
 
 
 
 
 
 
17
  intf = gr.Interface(fn=predict,
18
  inputs=images,
19
  outputs=labels,
20
- examples=examples)
 
 
 
21
 
22
- intf.launch(share=True)
 
1
  from fastai.vision.all import *
2
  import gradio as gr
3
+ import skimage
4
 
5
  learn = load_learner('model.pkl')
6
 
 
15
  labels = gr.outputs.Label()
16
  examples = ['powerline_down.jpg', 'powerline_tree.jpg']
17
 
18
+
19
+ title = "Power Line after Disaster Classifier"
20
+ description = "A classifier trained to identify power lines, trees and palm trees down after a storm with fastai. Created as a demo for fastai course for Apagon LLC."
21
+ interpretation='default'
22
+ enable_queue=True
23
+
24
  intf = gr.Interface(fn=predict,
25
  inputs=images,
26
  outputs=labels,
27
+ examples=examples,
28
+ title = title,
29
+ interpretation = interpretation,
30
+ enable_queue = enable_queue)
31
 
32
+ intf.launch()
powerline app.ipynb CHANGED
@@ -20,14 +20,27 @@
20
  },
21
  {
22
  "cell_type": "code",
23
- "execution_count": 3,
24
  "id": "3f54ef95",
25
  "metadata": {},
26
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
27
  "source": [
28
  "#|export\n",
29
  "from fastai.vision.all import *\n",
30
- "import gradio as gr"
 
31
  ]
32
  },
33
  {
@@ -190,35 +203,31 @@
190
  "labels = gr.outputs.Label()\n",
191
  "examples = ['powerline_down.jpg', 'powerline_tree.jpg']\n",
192
  "\n",
193
- "intf = gr.Interface(fn=predict, \n",
194
- " inputs=images, \n",
 
 
 
 
 
195
  " outputs=labels,\n",
196
- " examples=examples)\n",
 
 
 
197
  "\n",
198
  "intf.launch(share=True)"
199
  ]
200
  },
201
  {
202
  "cell_type": "code",
203
- "execution_count": 13,
204
  "id": "edcc9a51",
205
  "metadata": {},
206
- "outputs": [
207
- {
208
- "ename": "ImportError",
209
- "evalue": "cannot import name 'notebook2script' from 'nbdev.export' (/Users/hectortarrido-picart/mambaforge/envs/powerline-down-id/lib/python3.8/site-packages/nbdev/export.py)",
210
- "output_type": "error",
211
- "traceback": [
212
- "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
213
- "\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
214
- "Cell \u001b[0;32mIn[13], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mnbdev\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mexport\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m notebook2script\n\u001b[1;32m 2\u001b[0m notebook2script(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mpowerline app.ipynb\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
215
- "\u001b[0;31mImportError\u001b[0m: cannot import name 'notebook2script' from 'nbdev.export' (/Users/hectortarrido-picart/mambaforge/envs/powerline-down-id/lib/python3.8/site-packages/nbdev/export.py)"
216
- ]
217
- }
218
- ],
219
  "source": [
220
- "from nbdev.export import notebook2script\n",
221
- "notebook2script('powerline app.ipynb')"
222
  ]
223
  },
224
  {
 
20
  },
21
  {
22
  "cell_type": "code",
23
+ "execution_count": 2,
24
  "id": "3f54ef95",
25
  "metadata": {},
26
+ "outputs": [
27
+ {
28
+ "ename": "ModuleNotFoundError",
29
+ "evalue": "No module named 'skimage'",
30
+ "output_type": "error",
31
+ "traceback": [
32
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
33
+ "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
34
+ "Cell \u001b[0;32mIn[2], line 4\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mfastai\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mvision\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mall\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mgradio\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mgr\u001b[39;00m\n\u001b[0;32m----> 4\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mskimage\u001b[39;00m\n",
35
+ "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'skimage'"
36
+ ]
37
+ }
38
+ ],
39
  "source": [
40
  "#|export\n",
41
  "from fastai.vision.all import *\n",
42
+ "import gradio as gr\n",
43
+ "import skimage"
44
  ]
45
  },
46
  {
 
203
  "labels = gr.outputs.Label()\n",
204
  "examples = ['powerline_down.jpg', 'powerline_tree.jpg']\n",
205
  "\n",
206
+ "title = \"Power Line after Disaster Classifier\"\n",
207
+ "description = \"A classifier trained to identify power lines, trees and palm trees down after a storm with fastai. Created as a demo for fastai course for Apagon LLC.\"\n",
208
+ "interpretation='default'\n",
209
+ "enable_queue=True\n",
210
+ "\n",
211
+ "intf = gr.Interface(fn=predict,\n",
212
+ " inputs=images,\n",
213
  " outputs=labels,\n",
214
+ " examples=examples,\n",
215
+ " title = title,\n",
216
+ " interpretation = interpretation,\n",
217
+ " enable_queue = enable_queue)\n",
218
  "\n",
219
  "intf.launch(share=True)"
220
  ]
221
  },
222
  {
223
  "cell_type": "code",
224
+ "execution_count": 1,
225
  "id": "edcc9a51",
226
  "metadata": {},
227
+ "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
228
  "source": [
229
+ "# from nbdev.export import notebook2script\n",
230
+ "# notebook2script('powerline app.ipynb')"
231
  ]
232
  },
233
  {