fmussari commited on
Commit
d4c65cf
1 Parent(s): 29a1445

Shared in the forum

Browse files
.ipynb_checkpoints/tower_parts_app-checkpoint.ipynb CHANGED
@@ -2,7 +2,7 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": 1,
6
  "id": "7cfefe75",
7
  "metadata": {},
8
  "outputs": [],
@@ -20,7 +20,7 @@
20
  },
21
  {
22
  "cell_type": "code",
23
- "execution_count": 17,
24
  "id": "2d33068b",
25
  "metadata": {},
26
  "outputs": [],
@@ -33,7 +33,7 @@
33
  },
34
  {
35
  "cell_type": "code",
36
- "execution_count": 18,
37
  "id": "1ca4a10e",
38
  "metadata": {},
39
  "outputs": [],
@@ -43,7 +43,7 @@
43
  },
44
  {
45
  "cell_type": "code",
46
- "execution_count": 19,
47
  "id": "b3fe061e",
48
  "metadata": {},
49
  "outputs": [],
@@ -54,7 +54,7 @@
54
  },
55
  {
56
  "cell_type": "code",
57
- "execution_count": 20,
58
  "id": "28688e96",
59
  "metadata": {},
60
  "outputs": [
@@ -65,7 +65,7 @@
65
  "PILImage mode=RGB size=168x224"
66
  ]
67
  },
68
- "execution_count": 20,
69
  "metadata": {},
70
  "output_type": "execute_result"
71
  }
@@ -78,7 +78,7 @@
78
  },
79
  {
80
  "cell_type": "code",
81
- "execution_count": 21,
82
  "id": "4155e249",
83
  "metadata": {},
84
  "outputs": [
@@ -125,7 +125,7 @@
125
  " 7.7552e-06, 4.4144e-04]))"
126
  ]
127
  },
128
- "execution_count": 21,
129
  "metadata": {},
130
  "output_type": "execute_result"
131
  }
@@ -136,7 +136,7 @@
136
  },
137
  {
138
  "cell_type": "code",
139
- "execution_count": 22,
140
  "id": "ab3ad7a3",
141
  "metadata": {},
142
  "outputs": [
@@ -147,7 +147,7 @@
147
  "PILImage mode=RGB size=168x224"
148
  ]
149
  },
150
- "execution_count": 22,
151
  "metadata": {},
152
  "output_type": "execute_result"
153
  }
@@ -160,7 +160,7 @@
160
  },
161
  {
162
  "cell_type": "code",
163
- "execution_count": 23,
164
  "id": "0539d586",
165
  "metadata": {},
166
  "outputs": [
@@ -207,7 +207,7 @@
207
  " 1.5120e-02, 1.7516e-03]))"
208
  ]
209
  },
210
- "execution_count": 23,
211
  "metadata": {},
212
  "output_type": "execute_result"
213
  }
@@ -218,7 +218,7 @@
218
  },
219
  {
220
  "cell_type": "code",
221
- "execution_count": 24,
222
  "id": "c6f98324",
223
  "metadata": {},
224
  "outputs": [],
@@ -233,21 +233,22 @@
233
  },
234
  {
235
  "cell_type": "code",
236
- "execution_count": 53,
237
  "id": "369e09cd",
238
  "metadata": {},
239
  "outputs": [],
240
  "source": [
241
  "#|export\n",
242
- "title = \"Telecommunication Tower Parts Classifier\"\n",
243
- "description = \"This deep learning model was trained with only 478 images of telecommunication towers' parts.\"\n",
244
- "description += \"\\nThe parts the model recognize are:\"\n",
245
- "description += \"\\n- Base plate / Grounding bar / Ladder / Light / Lightning rod / Platform / Transmission lines\""
 
246
  ]
247
  },
248
  {
249
  "cell_type": "code",
250
- "execution_count": 54,
251
  "id": "94e69313",
252
  "metadata": {},
253
  "outputs": [
@@ -298,7 +299,7 @@
298
  " 'transmission_lines': 0.0017515908693894744}"
299
  ]
300
  },
301
- "execution_count": 54,
302
  "metadata": {},
303
  "output_type": "execute_result"
304
  }
@@ -309,13 +310,16 @@
309
  },
310
  {
311
  "cell_type": "code",
312
- "execution_count": 57,
313
  "id": "a5a2404a",
314
  "metadata": {},
315
  "outputs": [],
316
  "source": [
317
  "#export\n",
318
- "image = gr.inputs.Image(shape=(200, 200), label='Load image')\n",
 
 
 
319
  "label = gr.outputs.Label()\n",
320
  "\n",
321
  "\n",
@@ -327,7 +331,7 @@
327
  },
328
  {
329
  "cell_type": "code",
330
- "execution_count": 58,
331
  "id": "d9af47a8",
332
  "metadata": {},
333
  "outputs": [
@@ -335,7 +339,7 @@
335
  "name": "stdout",
336
  "output_type": "stream",
337
  "text": [
338
- "Running on local URL: http://127.0.0.1:7873/\n",
339
  "\n",
340
  "To create a public link, set `share=True` in `launch()`.\n"
341
  ]
@@ -344,11 +348,11 @@
344
  "data": {
345
  "text/plain": [
346
  "(<fastapi.applications.FastAPI at 0x7f9f892f96a0>,\n",
347
- " 'http://127.0.0.1:7873/',\n",
348
  " None)"
349
  ]
350
  },
351
- "execution_count": 58,
352
  "metadata": {},
353
  "output_type": "execute_result"
354
  }
@@ -362,7 +366,6 @@
362
  " examples=examples,\n",
363
  " title=title,\n",
364
  " description=description,\n",
365
- " live=True,\n",
366
  ")\n",
367
  "\n",
368
  "intf.launch(inline=False)"
@@ -370,7 +373,7 @@
370
  },
371
  {
372
  "cell_type": "code",
373
- "execution_count": 16,
374
  "id": "01519030",
375
  "metadata": {},
376
  "outputs": [
 
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": 109,
6
  "id": "7cfefe75",
7
  "metadata": {},
8
  "outputs": [],
 
20
  },
21
  {
22
  "cell_type": "code",
23
+ "execution_count": 110,
24
  "id": "2d33068b",
25
  "metadata": {},
26
  "outputs": [],
 
33
  },
34
  {
35
  "cell_type": "code",
36
+ "execution_count": 111,
37
  "id": "1ca4a10e",
38
  "metadata": {},
39
  "outputs": [],
 
43
  },
44
  {
45
  "cell_type": "code",
46
+ "execution_count": 112,
47
  "id": "b3fe061e",
48
  "metadata": {},
49
  "outputs": [],
 
54
  },
55
  {
56
  "cell_type": "code",
57
+ "execution_count": 113,
58
  "id": "28688e96",
59
  "metadata": {},
60
  "outputs": [
 
65
  "PILImage mode=RGB size=168x224"
66
  ]
67
  },
68
+ "execution_count": 113,
69
  "metadata": {},
70
  "output_type": "execute_result"
71
  }
 
78
  },
79
  {
80
  "cell_type": "code",
81
+ "execution_count": 114,
82
  "id": "4155e249",
83
  "metadata": {},
84
  "outputs": [
 
125
  " 7.7552e-06, 4.4144e-04]))"
126
  ]
127
  },
128
+ "execution_count": 114,
129
  "metadata": {},
130
  "output_type": "execute_result"
131
  }
 
136
  },
137
  {
138
  "cell_type": "code",
139
+ "execution_count": 115,
140
  "id": "ab3ad7a3",
141
  "metadata": {},
142
  "outputs": [
 
147
  "PILImage mode=RGB size=168x224"
148
  ]
149
  },
150
+ "execution_count": 115,
151
  "metadata": {},
152
  "output_type": "execute_result"
153
  }
 
160
  },
161
  {
162
  "cell_type": "code",
163
+ "execution_count": 116,
164
  "id": "0539d586",
165
  "metadata": {},
166
  "outputs": [
 
207
  " 1.5120e-02, 1.7516e-03]))"
208
  ]
209
  },
210
+ "execution_count": 116,
211
  "metadata": {},
212
  "output_type": "execute_result"
213
  }
 
218
  },
219
  {
220
  "cell_type": "code",
221
+ "execution_count": 117,
222
  "id": "c6f98324",
223
  "metadata": {},
224
  "outputs": [],
 
233
  },
234
  {
235
  "cell_type": "code",
236
+ "execution_count": 154,
237
  "id": "369e09cd",
238
  "metadata": {},
239
  "outputs": [],
240
  "source": [
241
  "#|export\n",
242
+ "title = \"Classify Telecommunication Tower Parts\"\n",
243
+ "description = \"This deep learning model was trained with fastai using only 478 images of telecommunication towers parts.\"\n",
244
+ "description += \"\\nThe model was trained to recognize the following 8 categories:\"\n",
245
+ "description += \"\\n- Base plate | Grounding bar | Identification | Ladder | Light | Lightning rod | Platform | Transmission lines\"\n",
246
+ "description += \"\\n- You can test the model with the given examples (see below), or upload your own pictures.\"\n"
247
  ]
248
  },
249
  {
250
  "cell_type": "code",
251
+ "execution_count": 155,
252
  "id": "94e69313",
253
  "metadata": {},
254
  "outputs": [
 
299
  " 'transmission_lines': 0.0017515908693894744}"
300
  ]
301
  },
302
+ "execution_count": 155,
303
  "metadata": {},
304
  "output_type": "execute_result"
305
  }
 
310
  },
311
  {
312
  "cell_type": "code",
313
+ "execution_count": 156,
314
  "id": "a5a2404a",
315
  "metadata": {},
316
  "outputs": [],
317
  "source": [
318
  "#export\n",
319
+ "image = gr.inputs.Image(\n",
320
+ " shape=(200,200), \n",
321
+ " label='Load image'\n",
322
+ ")\n",
323
  "label = gr.outputs.Label()\n",
324
  "\n",
325
  "\n",
 
331
  },
332
  {
333
  "cell_type": "code",
334
+ "execution_count": 157,
335
  "id": "d9af47a8",
336
  "metadata": {},
337
  "outputs": [
 
339
  "name": "stdout",
340
  "output_type": "stream",
341
  "text": [
342
+ "Running on local URL: http://127.0.0.1:7888/\n",
343
  "\n",
344
  "To create a public link, set `share=True` in `launch()`.\n"
345
  ]
 
348
  "data": {
349
  "text/plain": [
350
  "(<fastapi.applications.FastAPI at 0x7f9f892f96a0>,\n",
351
+ " 'http://127.0.0.1:7888/',\n",
352
  " None)"
353
  ]
354
  },
355
+ "execution_count": 157,
356
  "metadata": {},
357
  "output_type": "execute_result"
358
  }
 
366
  " examples=examples,\n",
367
  " title=title,\n",
368
  " description=description,\n",
 
369
  ")\n",
370
  "\n",
371
  "intf.launch(inline=False)"
 
373
  },
374
  {
375
  "cell_type": "code",
376
+ "execution_count": 158,
377
  "id": "01519030",
378
  "metadata": {},
379
  "outputs": [
app.py CHANGED
@@ -21,9 +21,10 @@ def classify_image(img):
21
 
22
  # Cell
23
  title = "Classify Telecommunication Tower Parts"
24
- description = "This deep learning model was trained with fastai using only 478 images of telecommunication towers' parts."
25
- description += "\nThe model recognizes the following 7 categories:"
26
  description += "\n- Base plate | Grounding bar | Identification | Ladder | Light | Lightning rod | Platform | Transmission lines"
 
27
 
28
 
29
  # Cell
 
21
 
22
  # Cell
23
  title = "Classify Telecommunication Tower Parts"
24
+ description = "This deep learning model was trained with fastai using only 478 images of telecommunication towers parts."
25
+ description += "\nThe model was trained to recognize the following 8 categories:"
26
  description += "\n- Base plate | Grounding bar | Identification | Ladder | Light | Lightning rod | Platform | Transmission lines"
27
+ description += "\n- You can test the model with the given examples (see below), or upload your own pictures."
28
 
29
 
30
  # Cell
tower_parts_app.ipynb CHANGED
@@ -233,21 +233,22 @@
233
  },
234
  {
235
  "cell_type": "code",
236
- "execution_count": 139,
237
  "id": "369e09cd",
238
  "metadata": {},
239
  "outputs": [],
240
  "source": [
241
  "#|export\n",
242
  "title = \"Classify Telecommunication Tower Parts\"\n",
243
- "description = \"This deep learning model was trained with fastai using only 478 images of telecommunication towers' parts.\"\n",
244
- "description += \"\\nThe model recognizes the following 7 categories:\"\n",
245
- "description += \"\\n- Base plate | Grounding bar | Identification | Ladder | Light | Lightning rod | Platform | Transmission lines\"\n"
 
246
  ]
247
  },
248
  {
249
  "cell_type": "code",
250
- "execution_count": 140,
251
  "id": "94e69313",
252
  "metadata": {},
253
  "outputs": [
@@ -298,7 +299,7 @@
298
  " 'transmission_lines': 0.0017515908693894744}"
299
  ]
300
  },
301
- "execution_count": 140,
302
  "metadata": {},
303
  "output_type": "execute_result"
304
  }
@@ -309,7 +310,7 @@
309
  },
310
  {
311
  "cell_type": "code",
312
- "execution_count": 141,
313
  "id": "a5a2404a",
314
  "metadata": {},
315
  "outputs": [],
@@ -330,7 +331,7 @@
330
  },
331
  {
332
  "cell_type": "code",
333
- "execution_count": 142,
334
  "id": "d9af47a8",
335
  "metadata": {},
336
  "outputs": [
@@ -338,7 +339,7 @@
338
  "name": "stdout",
339
  "output_type": "stream",
340
  "text": [
341
- "Running on local URL: http://127.0.0.1:7885/\n",
342
  "\n",
343
  "To create a public link, set `share=True` in `launch()`.\n"
344
  ]
@@ -347,11 +348,11 @@
347
  "data": {
348
  "text/plain": [
349
  "(<fastapi.applications.FastAPI at 0x7f9f892f96a0>,\n",
350
- " 'http://127.0.0.1:7885/',\n",
351
  " None)"
352
  ]
353
  },
354
- "execution_count": 142,
355
  "metadata": {},
356
  "output_type": "execute_result"
357
  }
@@ -372,7 +373,7 @@
372
  },
373
  {
374
  "cell_type": "code",
375
- "execution_count": 143,
376
  "id": "01519030",
377
  "metadata": {},
378
  "outputs": [
 
233
  },
234
  {
235
  "cell_type": "code",
236
+ "execution_count": 164,
237
  "id": "369e09cd",
238
  "metadata": {},
239
  "outputs": [],
240
  "source": [
241
  "#|export\n",
242
  "title = \"Classify Telecommunication Tower Parts\"\n",
243
+ "description = \"This deep learning model was trained with fastai using only 478 images of telecommunication towers parts.\"\n",
244
+ "description += \"\\nThe model was trained to recognize the following 8 categories:\"\n",
245
+ "description += \"\\n- Base plate | Grounding bar | Identification | Ladder | Light | Lightning rod | Platform | Transmission lines\"\n",
246
+ "description += \"\\n- You can test the model by clicking on the given examples below, or uploading your own pictures and then clicking on «Submit»\"\n"
247
  ]
248
  },
249
  {
250
  "cell_type": "code",
251
+ "execution_count": 165,
252
  "id": "94e69313",
253
  "metadata": {},
254
  "outputs": [
 
299
  " 'transmission_lines': 0.0017515908693894744}"
300
  ]
301
  },
302
+ "execution_count": 165,
303
  "metadata": {},
304
  "output_type": "execute_result"
305
  }
 
310
  },
311
  {
312
  "cell_type": "code",
313
+ "execution_count": 166,
314
  "id": "a5a2404a",
315
  "metadata": {},
316
  "outputs": [],
 
331
  },
332
  {
333
  "cell_type": "code",
334
+ "execution_count": 167,
335
  "id": "d9af47a8",
336
  "metadata": {},
337
  "outputs": [
 
339
  "name": "stdout",
340
  "output_type": "stream",
341
  "text": [
342
+ "Running on local URL: http://127.0.0.1:7890/\n",
343
  "\n",
344
  "To create a public link, set `share=True` in `launch()`.\n"
345
  ]
 
348
  "data": {
349
  "text/plain": [
350
  "(<fastapi.applications.FastAPI at 0x7f9f892f96a0>,\n",
351
+ " 'http://127.0.0.1:7890/',\n",
352
  " None)"
353
  ]
354
  },
355
+ "execution_count": 167,
356
  "metadata": {},
357
  "output_type": "execute_result"
358
  }
 
373
  },
374
  {
375
  "cell_type": "code",
376
+ "execution_count": 168,
377
  "id": "01519030",
378
  "metadata": {},
379
  "outputs": [