prasanth.thangavel commited on
Commit
6d1b006
1 Parent(s): 466901f

Minor bug fix in app

Browse files
Files changed (3) hide show
  1. README.md +1 -3
  2. app.ipynb +73 -36
  3. app.py +2 -2
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  title: Who Is The Hero
3
- emoji: 💻
4
  colorFrom: blue
5
  colorTo: yellow
6
  sdk: gradio
@@ -9,5 +9,3 @@ app_file: app.py
9
  pinned: false
10
  license: apache-2.0
11
  ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: Who Is The Hero
3
+ emoji: 🦸
4
  colorFrom: blue
5
  colorTo: yellow
6
  sdk: gradio
 
9
  pinned: false
10
  license: apache-2.0
11
  ---
 
 
app.ipynb CHANGED
@@ -25,12 +25,12 @@
25
  },
26
  {
27
  "cell_type": "code",
28
- "execution_count": 51,
29
  "id": "754b56c0",
30
  "metadata": {
31
  "ExecuteTime": {
32
- "end_time": "2023-06-04T03:54:49.353855Z",
33
- "start_time": "2023-06-04T03:54:49.348893Z"
34
  }
35
  },
36
  "outputs": [],
@@ -45,12 +45,12 @@
45
  },
46
  {
47
  "cell_type": "code",
48
- "execution_count": 52,
49
  "id": "e4be8667",
50
  "metadata": {
51
  "ExecuteTime": {
52
- "end_time": "2023-06-04T03:54:49.582532Z",
53
- "start_time": "2023-06-04T03:54:49.489341Z"
54
  },
55
  "scrolled": true
56
  },
@@ -69,7 +69,7 @@
69
  "PILImage mode=RGB size=148x192"
70
  ]
71
  },
72
- "execution_count": 52,
73
  "metadata": {},
74
  "output_type": "execute_result"
75
  }
@@ -83,12 +83,12 @@
83
  },
84
  {
85
  "cell_type": "code",
86
- "execution_count": 53,
87
  "id": "c7765b36",
88
  "metadata": {
89
  "ExecuteTime": {
90
- "end_time": "2023-06-04T03:54:50.175615Z",
91
- "start_time": "2023-06-04T03:54:50.113295Z"
92
  }
93
  },
94
  "outputs": [],
@@ -99,12 +99,12 @@
99
  },
100
  {
101
  "cell_type": "code",
102
- "execution_count": 54,
103
  "id": "92e8d6b4",
104
  "metadata": {
105
  "ExecuteTime": {
106
- "end_time": "2023-06-04T03:54:50.331722Z",
107
- "start_time": "2023-06-04T03:54:50.283858Z"
108
  }
109
  },
110
  "outputs": [
@@ -149,8 +149,8 @@
149
  "name": "stdout",
150
  "output_type": "stream",
151
  "text": [
152
- "CPU times: user 50.7 ms, sys: 40.4 ms, total: 91.2 ms\n",
153
- "Wall time: 43 ms\n"
154
  ]
155
  },
156
  {
@@ -159,7 +159,7 @@
159
  "('batman', tensor(0), tensor([0.9405, 0.0028, 0.0566]))"
160
  ]
161
  },
162
- "execution_count": 54,
163
  "metadata": {},
164
  "output_type": "execute_result"
165
  }
@@ -171,12 +171,12 @@
171
  },
172
  {
173
  "cell_type": "code",
174
- "execution_count": 58,
175
  "id": "12b3519f",
176
  "metadata": {
177
  "ExecuteTime": {
178
- "end_time": "2023-06-04T03:55:02.653361Z",
179
- "start_time": "2023-06-04T03:55:02.646931Z"
180
  }
181
  },
182
  "outputs": [
@@ -217,12 +217,12 @@
217
  },
218
  {
219
  "cell_type": "code",
220
- "execution_count": 59,
221
  "id": "0be42346",
222
  "metadata": {
223
  "ExecuteTime": {
224
- "end_time": "2023-06-04T03:55:03.201333Z",
225
- "start_time": "2023-06-04T03:55:03.154678Z"
226
  }
227
  },
228
  "outputs": [
@@ -272,7 +272,7 @@
272
  " 'Bruce Wayne')"
273
  ]
274
  },
275
- "execution_count": 59,
276
  "metadata": {},
277
  "output_type": "execute_result"
278
  }
@@ -283,12 +283,12 @@
283
  },
284
  {
285
  "cell_type": "code",
286
- "execution_count": 60,
287
- "id": "5252d05c",
288
  "metadata": {
289
  "ExecuteTime": {
290
- "end_time": "2023-06-04T03:55:06.297996Z",
291
- "start_time": "2023-06-04T03:55:05.937661Z"
292
  }
293
  },
294
  "outputs": [
@@ -308,12 +308,12 @@
308
  },
309
  {
310
  "cell_type": "code",
311
- "execution_count": 62,
312
  "id": "d845ec5f",
313
  "metadata": {
314
  "ExecuteTime": {
315
- "end_time": "2023-06-04T03:55:24.063845Z",
316
- "start_time": "2023-06-04T03:55:23.091052Z"
317
  }
318
  },
319
  "outputs": [
@@ -321,7 +321,7 @@
321
  "name": "stdout",
322
  "output_type": "stream",
323
  "text": [
324
- "Running on local URL: http://127.0.0.1:7867\n",
325
  "\n",
326
  "To create a public link, set `share=True` in `launch()`.\n"
327
  ]
@@ -329,7 +329,7 @@
329
  {
330
  "data": {
331
  "text/html": [
332
- "<div><iframe src=\"http://127.0.0.1:7867/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
333
  ],
334
  "text/plain": [
335
  "<IPython.core.display.HTML object>"
@@ -342,7 +342,7 @@
342
  "data": {
343
  "text/plain": []
344
  },
345
- "execution_count": 62,
346
  "metadata": {},
347
  "output_type": "execute_result"
348
  },
@@ -373,6 +373,43 @@
373
  "metadata": {},
374
  "output_type": "display_data"
375
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  {
377
  "data": {
378
  "text/html": [],
@@ -413,12 +450,12 @@
413
  },
414
  {
415
  "cell_type": "code",
416
- "execution_count": 63,
417
  "id": "b942385f",
418
  "metadata": {
419
  "ExecuteTime": {
420
- "end_time": "2023-06-04T03:55:42.230480Z",
421
- "start_time": "2023-06-04T03:55:42.218268Z"
422
  }
423
  },
424
  "outputs": [
 
25
  },
26
  {
27
  "cell_type": "code",
28
+ "execution_count": 1,
29
  "id": "754b56c0",
30
  "metadata": {
31
  "ExecuteTime": {
32
+ "end_time": "2023-06-04T04:18:12.302048Z",
33
+ "start_time": "2023-06-04T04:18:10.013098Z"
34
  }
35
  },
36
  "outputs": [],
 
45
  },
46
  {
47
  "cell_type": "code",
48
+ "execution_count": 2,
49
  "id": "e4be8667",
50
  "metadata": {
51
  "ExecuteTime": {
52
+ "end_time": "2023-06-04T04:18:13.041741Z",
53
+ "start_time": "2023-06-04T04:18:12.948260Z"
54
  },
55
  "scrolled": true
56
  },
 
69
  "PILImage mode=RGB size=148x192"
70
  ]
71
  },
72
+ "execution_count": 2,
73
  "metadata": {},
74
  "output_type": "execute_result"
75
  }
 
83
  },
84
  {
85
  "cell_type": "code",
86
+ "execution_count": 3,
87
  "id": "c7765b36",
88
  "metadata": {
89
  "ExecuteTime": {
90
+ "end_time": "2023-06-04T04:18:13.513099Z",
91
+ "start_time": "2023-06-04T04:18:13.479749Z"
92
  }
93
  },
94
  "outputs": [],
 
99
  },
100
  {
101
  "cell_type": "code",
102
+ "execution_count": 4,
103
  "id": "92e8d6b4",
104
  "metadata": {
105
  "ExecuteTime": {
106
+ "end_time": "2023-06-04T04:18:13.811788Z",
107
+ "start_time": "2023-06-04T04:18:13.746509Z"
108
  }
109
  },
110
  "outputs": [
 
149
  "name": "stdout",
150
  "output_type": "stream",
151
  "text": [
152
+ "CPU times: user 51.9 ms, sys: 46.6 ms, total: 98.6 ms\n",
153
+ "Wall time: 61.5 ms\n"
154
  ]
155
  },
156
  {
 
159
  "('batman', tensor(0), tensor([0.9405, 0.0028, 0.0566]))"
160
  ]
161
  },
162
+ "execution_count": 4,
163
  "metadata": {},
164
  "output_type": "execute_result"
165
  }
 
171
  },
172
  {
173
  "cell_type": "code",
174
+ "execution_count": 5,
175
  "id": "12b3519f",
176
  "metadata": {
177
  "ExecuteTime": {
178
+ "end_time": "2023-06-04T04:18:14.466326Z",
179
+ "start_time": "2023-06-04T04:18:14.460213Z"
180
  }
181
  },
182
  "outputs": [
 
217
  },
218
  {
219
  "cell_type": "code",
220
+ "execution_count": 6,
221
  "id": "0be42346",
222
  "metadata": {
223
  "ExecuteTime": {
224
+ "end_time": "2023-06-04T04:18:15.324202Z",
225
+ "start_time": "2023-06-04T04:18:15.281352Z"
226
  }
227
  },
228
  "outputs": [
 
272
  " 'Bruce Wayne')"
273
  ]
274
  },
275
+ "execution_count": 6,
276
  "metadata": {},
277
  "output_type": "execute_result"
278
  }
 
283
  },
284
  {
285
  "cell_type": "code",
286
+ "execution_count": 7,
287
+ "id": "826388a1",
288
  "metadata": {
289
  "ExecuteTime": {
290
+ "end_time": "2023-06-04T04:18:16.173080Z",
291
+ "start_time": "2023-06-04T04:18:15.829127Z"
292
  }
293
  },
294
  "outputs": [
 
308
  },
309
  {
310
  "cell_type": "code",
311
+ "execution_count": 8,
312
  "id": "d845ec5f",
313
  "metadata": {
314
  "ExecuteTime": {
315
+ "end_time": "2023-06-04T04:18:18.233242Z",
316
+ "start_time": "2023-06-04T04:18:16.393046Z"
317
  }
318
  },
319
  "outputs": [
 
321
  "name": "stdout",
322
  "output_type": "stream",
323
  "text": [
324
+ "Running on local URL: http://127.0.0.1:7860\n",
325
  "\n",
326
  "To create a public link, set `share=True` in `launch()`.\n"
327
  ]
 
329
  {
330
  "data": {
331
  "text/html": [
332
+ "<div><iframe src=\"http://127.0.0.1:7860/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
333
  ],
334
  "text/plain": [
335
  "<IPython.core.display.HTML object>"
 
342
  "data": {
343
  "text/plain": []
344
  },
345
+ "execution_count": 8,
346
  "metadata": {},
347
  "output_type": "execute_result"
348
  },
 
373
  "metadata": {},
374
  "output_type": "display_data"
375
  },
376
+ {
377
+ "data": {
378
+ "text/html": [],
379
+ "text/plain": [
380
+ "<IPython.core.display.HTML object>"
381
+ ]
382
+ },
383
+ "metadata": {},
384
+ "output_type": "display_data"
385
+ },
386
+ {
387
+ "data": {
388
+ "text/html": [
389
+ "\n",
390
+ "<style>\n",
391
+ " /* Turns off some styling */\n",
392
+ " progress {\n",
393
+ " /* gets rid of default border in Firefox and Opera. */\n",
394
+ " border: none;\n",
395
+ " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
396
+ " background-size: auto;\n",
397
+ " }\n",
398
+ " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
399
+ " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
400
+ " }\n",
401
+ " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
402
+ " background: #F44336;\n",
403
+ " }\n",
404
+ "</style>\n"
405
+ ],
406
+ "text/plain": [
407
+ "<IPython.core.display.HTML object>"
408
+ ]
409
+ },
410
+ "metadata": {},
411
+ "output_type": "display_data"
412
+ },
413
  {
414
  "data": {
415
  "text/html": [],
 
450
  },
451
  {
452
  "cell_type": "code",
453
+ "execution_count": 9,
454
  "id": "b942385f",
455
  "metadata": {
456
  "ExecuteTime": {
457
+ "end_time": "2023-06-04T04:18:28.883975Z",
458
+ "start_time": "2023-06-04T04:18:28.532380Z"
459
  }
460
  },
461
  "outputs": [
app.py CHANGED
@@ -38,7 +38,7 @@ def classify_image(img):
38
 
39
  return prediction, alter_ego
40
 
41
- # %% app.ipynb 10
42
  examples = [
43
  'images/batman.jpg', 'images/batman2.jpg', 'images/batman3.png',
44
  'images/superman1.jpg', 'images/superman2.jpg', 'images/superman3.jpg',
@@ -48,7 +48,7 @@ examples = [
48
  intf = gr.Interface(
49
  fn=classify_image,
50
  inputs=gr.Image(shape=(192,192)),
51
- outputs=gr.Label(label='Predicted output'),
52
  examples=examples,
53
  title="Who is the 'Super Hero' Classifier",
54
  description="Classifier is fine-tuned on pre-trained **resnet18** model using ~200 images in total"
 
38
 
39
  return prediction, alter_ego
40
 
41
+ # %% app.ipynb 9
42
  examples = [
43
  'images/batman.jpg', 'images/batman2.jpg', 'images/batman3.png',
44
  'images/superman1.jpg', 'images/superman2.jpg', 'images/superman3.jpg',
 
48
  intf = gr.Interface(
49
  fn=classify_image,
50
  inputs=gr.Image(shape=(192,192)),
51
+ outputs=[gr.Label(label='Predicted output'), gr.Text(label="Alter Ego")],
52
  examples=examples,
53
  title="Who is the 'Super Hero' Classifier",
54
  description="Classifier is fine-tuned on pre-trained **resnet18** model using ~200 images in total"