Chizoba Obasi commited on
Commit
77416ab
·
1 Parent(s): 69e9bba

modify gr.Image() in app.ipynb

Browse files
Files changed (3) hide show
  1. .ipynb_checkpoints/app-checkpoint.ipynb +21 -24
  2. app.ipynb +21 -24
  3. app.py +1 -1
.ipynb_checkpoints/app-checkpoint.ipynb CHANGED
@@ -232,7 +232,7 @@
232
  },
233
  {
234
  "cell_type": "code",
235
- "execution_count": 12,
236
  "id": "abd33e96",
237
  "metadata": {},
238
  "outputs": [
@@ -240,14 +240,10 @@
240
  "name": "stderr",
241
  "output_type": "stream",
242
  "text": [
243
- "/Users/CEO/miniconda3/envs/py37/lib/python3.7/site-packages/gradio/inputs.py:260: UserWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n",
244
- " \"Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\",\n",
245
- "/Users/CEO/miniconda3/envs/py37/lib/python3.7/site-packages/gradio/inputs.py:270: UserWarning: `optional` parameter is deprecated, and it has no effect\n",
246
- " optional=optional,\n",
247
- "/Users/CEO/miniconda3/envs/py37/lib/python3.7/site-packages/gradio/outputs.py:198: UserWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\n",
248
- " \"Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\",\n",
249
- "/Users/CEO/miniconda3/envs/py37/lib/python3.7/site-packages/gradio/outputs.py:200: UserWarning: The 'type' parameter has been deprecated. Use the Number component instead.\n",
250
- " super().__init__(num_top_classes=num_top_classes, type=type, label=label)\n"
251
  ]
252
  },
253
  {
@@ -256,7 +252,7 @@
256
  "text": [
257
  "IMPORTANT: You are using gradio version 3.34.0, however version 4.29.0 is available, please upgrade.\n",
258
  "--------\n",
259
- "Running on local URL: http://127.0.0.1:7861\n",
260
  "\n",
261
  "To create a public link, set `share=True` in `launch()`.\n"
262
  ]
@@ -265,14 +261,15 @@
265
  "data": {
266
  "text/plain": []
267
  },
268
- "execution_count": 12,
269
  "metadata": {},
270
  "output_type": "execute_result"
271
  }
272
  ],
273
  "source": [
274
  "#|export\n",
275
- "image = gr.Image(shape=(192, 192))\n",
 
276
  "label = gr.Label()\n",
277
  "examples = ['dog.jpeg', 'cat.jpeg', 'bear.jpeg', 'dog2.jpeg']\n",
278
  "\n",
@@ -282,7 +279,7 @@
282
  },
283
  {
284
  "cell_type": "code",
285
- "execution_count": 10,
286
  "id": "f0d25829",
287
  "metadata": {},
288
  "outputs": [],
@@ -292,7 +289,7 @@
292
  },
293
  {
294
  "cell_type": "code",
295
- "execution_count": 13,
296
  "id": "c75b8ca4",
297
  "metadata": {},
298
  "outputs": [],
@@ -302,7 +299,7 @@
302
  },
303
  {
304
  "cell_type": "code",
305
- "execution_count": 14,
306
  "id": "a1bd98e0",
307
  "metadata": {},
308
  "outputs": [
@@ -326,7 +323,7 @@
326
  " requires_grad=True)"
327
  ]
328
  },
329
- "execution_count": 14,
330
  "metadata": {},
331
  "output_type": "execute_result"
332
  }
@@ -337,7 +334,7 @@
337
  },
338
  {
339
  "cell_type": "code",
340
- "execution_count": 15,
341
  "id": "9a09b2fd",
342
  "metadata": {},
343
  "outputs": [
@@ -347,7 +344,7 @@
347
  "torch.Size([64, 3, 7, 7])"
348
  ]
349
  },
350
- "execution_count": 15,
351
  "metadata": {},
352
  "output_type": "execute_result"
353
  }
@@ -358,7 +355,7 @@
358
  },
359
  {
360
  "cell_type": "code",
361
- "execution_count": 16,
362
  "id": "a05ca56d",
363
  "metadata": {},
364
  "outputs": [
@@ -627,7 +624,7 @@
627
  " -7.1066e-02, -6.6630e-02]]]], requires_grad=True)"
628
  ]
629
  },
630
- "execution_count": 16,
631
  "metadata": {},
632
  "output_type": "execute_result"
633
  }
@@ -646,7 +643,7 @@
646
  },
647
  {
648
  "cell_type": "code",
649
- "execution_count": 25,
650
  "id": "416da297",
651
  "metadata": {},
652
  "outputs": [],
@@ -659,7 +656,7 @@
659
  },
660
  {
661
  "cell_type": "code",
662
- "execution_count": 26,
663
  "id": "a0d2f5c6",
664
  "metadata": {},
665
  "outputs": [],
@@ -670,7 +667,7 @@
670
  },
671
  {
672
  "cell_type": "code",
673
- "execution_count": 27,
674
  "id": "4d5c5a92",
675
  "metadata": {},
676
  "outputs": [],
@@ -681,7 +678,7 @@
681
  },
682
  {
683
  "cell_type": "code",
684
- "execution_count": 28,
685
  "id": "3debd079",
686
  "metadata": {},
687
  "outputs": [],
 
232
  },
233
  {
234
  "cell_type": "code",
235
+ "execution_count": 50,
236
  "id": "abd33e96",
237
  "metadata": {},
238
  "outputs": [
 
240
  "name": "stderr",
241
  "output_type": "stream",
242
  "text": [
243
+ "/Users/CEO/miniconda3/envs/py37/lib/python3.7/site-packages/ipykernel_launcher.py:3: UserWarning: `width` is deprecated in `Interface()`, please use it within `launch()` instead.\n",
244
+ " This is separate from the ipykernel package so we can avoid doing imports until\n",
245
+ "/Users/CEO/miniconda3/envs/py37/lib/python3.7/site-packages/ipykernel_launcher.py:3: UserWarning: `height` is deprecated in `Interface()`, please use it within `launch()` instead.\n",
246
+ " This is separate from the ipykernel package so we can avoid doing imports until\n"
 
 
 
 
247
  ]
248
  },
249
  {
 
252
  "text": [
253
  "IMPORTANT: You are using gradio version 3.34.0, however version 4.29.0 is available, please upgrade.\n",
254
  "--------\n",
255
+ "Running on local URL: http://127.0.0.1:7864\n",
256
  "\n",
257
  "To create a public link, set `share=True` in `launch()`.\n"
258
  ]
 
261
  "data": {
262
  "text/plain": []
263
  },
264
+ "execution_count": 50,
265
  "metadata": {},
266
  "output_type": "execute_result"
267
  }
268
  ],
269
  "source": [
270
  "#|export\n",
271
+ "# image = gr.Image(shape=(192, 192))\n",
272
+ "image = gr.Image(width=192, height=192)\n",
273
  "label = gr.Label()\n",
274
  "examples = ['dog.jpeg', 'cat.jpeg', 'bear.jpeg', 'dog2.jpeg']\n",
275
  "\n",
 
279
  },
280
  {
281
  "cell_type": "code",
282
+ "execution_count": 51,
283
  "id": "f0d25829",
284
  "metadata": {},
285
  "outputs": [],
 
289
  },
290
  {
291
  "cell_type": "code",
292
+ "execution_count": 52,
293
  "id": "c75b8ca4",
294
  "metadata": {},
295
  "outputs": [],
 
299
  },
300
  {
301
  "cell_type": "code",
302
+ "execution_count": 53,
303
  "id": "a1bd98e0",
304
  "metadata": {},
305
  "outputs": [
 
323
  " requires_grad=True)"
324
  ]
325
  },
326
+ "execution_count": 53,
327
  "metadata": {},
328
  "output_type": "execute_result"
329
  }
 
334
  },
335
  {
336
  "cell_type": "code",
337
+ "execution_count": 54,
338
  "id": "9a09b2fd",
339
  "metadata": {},
340
  "outputs": [
 
344
  "torch.Size([64, 3, 7, 7])"
345
  ]
346
  },
347
+ "execution_count": 54,
348
  "metadata": {},
349
  "output_type": "execute_result"
350
  }
 
355
  },
356
  {
357
  "cell_type": "code",
358
+ "execution_count": 55,
359
  "id": "a05ca56d",
360
  "metadata": {},
361
  "outputs": [
 
624
  " -7.1066e-02, -6.6630e-02]]]], requires_grad=True)"
625
  ]
626
  },
627
+ "execution_count": 55,
628
  "metadata": {},
629
  "output_type": "execute_result"
630
  }
 
643
  },
644
  {
645
  "cell_type": "code",
646
+ "execution_count": 56,
647
  "id": "416da297",
648
  "metadata": {},
649
  "outputs": [],
 
656
  },
657
  {
658
  "cell_type": "code",
659
+ "execution_count": 57,
660
  "id": "a0d2f5c6",
661
  "metadata": {},
662
  "outputs": [],
 
667
  },
668
  {
669
  "cell_type": "code",
670
+ "execution_count": 58,
671
  "id": "4d5c5a92",
672
  "metadata": {},
673
  "outputs": [],
 
678
  },
679
  {
680
  "cell_type": "code",
681
+ "execution_count": 59,
682
  "id": "3debd079",
683
  "metadata": {},
684
  "outputs": [],
app.ipynb CHANGED
@@ -232,7 +232,7 @@
232
  },
233
  {
234
  "cell_type": "code",
235
- "execution_count": 12,
236
  "id": "abd33e96",
237
  "metadata": {},
238
  "outputs": [
@@ -240,14 +240,10 @@
240
  "name": "stderr",
241
  "output_type": "stream",
242
  "text": [
243
- "/Users/CEO/miniconda3/envs/py37/lib/python3.7/site-packages/gradio/inputs.py:260: UserWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n",
244
- " \"Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\",\n",
245
- "/Users/CEO/miniconda3/envs/py37/lib/python3.7/site-packages/gradio/inputs.py:270: UserWarning: `optional` parameter is deprecated, and it has no effect\n",
246
- " optional=optional,\n",
247
- "/Users/CEO/miniconda3/envs/py37/lib/python3.7/site-packages/gradio/outputs.py:198: UserWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\n",
248
- " \"Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\",\n",
249
- "/Users/CEO/miniconda3/envs/py37/lib/python3.7/site-packages/gradio/outputs.py:200: UserWarning: The 'type' parameter has been deprecated. Use the Number component instead.\n",
250
- " super().__init__(num_top_classes=num_top_classes, type=type, label=label)\n"
251
  ]
252
  },
253
  {
@@ -256,7 +252,7 @@
256
  "text": [
257
  "IMPORTANT: You are using gradio version 3.34.0, however version 4.29.0 is available, please upgrade.\n",
258
  "--------\n",
259
- "Running on local URL: http://127.0.0.1:7861\n",
260
  "\n",
261
  "To create a public link, set `share=True` in `launch()`.\n"
262
  ]
@@ -265,14 +261,15 @@
265
  "data": {
266
  "text/plain": []
267
  },
268
- "execution_count": 12,
269
  "metadata": {},
270
  "output_type": "execute_result"
271
  }
272
  ],
273
  "source": [
274
  "#|export\n",
275
- "image = gr.Image(shape=(192, 192))\n",
 
276
  "label = gr.Label()\n",
277
  "examples = ['dog.jpeg', 'cat.jpeg', 'bear.jpeg', 'dog2.jpeg']\n",
278
  "\n",
@@ -282,7 +279,7 @@
282
  },
283
  {
284
  "cell_type": "code",
285
- "execution_count": 10,
286
  "id": "f0d25829",
287
  "metadata": {},
288
  "outputs": [],
@@ -292,7 +289,7 @@
292
  },
293
  {
294
  "cell_type": "code",
295
- "execution_count": 13,
296
  "id": "c75b8ca4",
297
  "metadata": {},
298
  "outputs": [],
@@ -302,7 +299,7 @@
302
  },
303
  {
304
  "cell_type": "code",
305
- "execution_count": 14,
306
  "id": "a1bd98e0",
307
  "metadata": {},
308
  "outputs": [
@@ -326,7 +323,7 @@
326
  " requires_grad=True)"
327
  ]
328
  },
329
- "execution_count": 14,
330
  "metadata": {},
331
  "output_type": "execute_result"
332
  }
@@ -337,7 +334,7 @@
337
  },
338
  {
339
  "cell_type": "code",
340
- "execution_count": 15,
341
  "id": "9a09b2fd",
342
  "metadata": {},
343
  "outputs": [
@@ -347,7 +344,7 @@
347
  "torch.Size([64, 3, 7, 7])"
348
  ]
349
  },
350
- "execution_count": 15,
351
  "metadata": {},
352
  "output_type": "execute_result"
353
  }
@@ -358,7 +355,7 @@
358
  },
359
  {
360
  "cell_type": "code",
361
- "execution_count": 16,
362
  "id": "a05ca56d",
363
  "metadata": {},
364
  "outputs": [
@@ -627,7 +624,7 @@
627
  " -7.1066e-02, -6.6630e-02]]]], requires_grad=True)"
628
  ]
629
  },
630
- "execution_count": 16,
631
  "metadata": {},
632
  "output_type": "execute_result"
633
  }
@@ -646,7 +643,7 @@
646
  },
647
  {
648
  "cell_type": "code",
649
- "execution_count": 25,
650
  "id": "416da297",
651
  "metadata": {},
652
  "outputs": [],
@@ -659,7 +656,7 @@
659
  },
660
  {
661
  "cell_type": "code",
662
- "execution_count": 26,
663
  "id": "a0d2f5c6",
664
  "metadata": {},
665
  "outputs": [],
@@ -670,7 +667,7 @@
670
  },
671
  {
672
  "cell_type": "code",
673
- "execution_count": 27,
674
  "id": "4d5c5a92",
675
  "metadata": {},
676
  "outputs": [],
@@ -681,7 +678,7 @@
681
  },
682
  {
683
  "cell_type": "code",
684
- "execution_count": 29,
685
  "id": "3debd079",
686
  "metadata": {},
687
  "outputs": [],
 
232
  },
233
  {
234
  "cell_type": "code",
235
+ "execution_count": 50,
236
  "id": "abd33e96",
237
  "metadata": {},
238
  "outputs": [
 
240
  "name": "stderr",
241
  "output_type": "stream",
242
  "text": [
243
+ "/Users/CEO/miniconda3/envs/py37/lib/python3.7/site-packages/ipykernel_launcher.py:3: UserWarning: `width` is deprecated in `Interface()`, please use it within `launch()` instead.\n",
244
+ " This is separate from the ipykernel package so we can avoid doing imports until\n",
245
+ "/Users/CEO/miniconda3/envs/py37/lib/python3.7/site-packages/ipykernel_launcher.py:3: UserWarning: `height` is deprecated in `Interface()`, please use it within `launch()` instead.\n",
246
+ " This is separate from the ipykernel package so we can avoid doing imports until\n"
 
 
 
 
247
  ]
248
  },
249
  {
 
252
  "text": [
253
  "IMPORTANT: You are using gradio version 3.34.0, however version 4.29.0 is available, please upgrade.\n",
254
  "--------\n",
255
+ "Running on local URL: http://127.0.0.1:7864\n",
256
  "\n",
257
  "To create a public link, set `share=True` in `launch()`.\n"
258
  ]
 
261
  "data": {
262
  "text/plain": []
263
  },
264
+ "execution_count": 50,
265
  "metadata": {},
266
  "output_type": "execute_result"
267
  }
268
  ],
269
  "source": [
270
  "#|export\n",
271
+ "# image = gr.Image(shape=(192, 192))\n",
272
+ "image = gr.Image(width=192, height=192)\n",
273
  "label = gr.Label()\n",
274
  "examples = ['dog.jpeg', 'cat.jpeg', 'bear.jpeg', 'dog2.jpeg']\n",
275
  "\n",
 
279
  },
280
  {
281
  "cell_type": "code",
282
+ "execution_count": 51,
283
  "id": "f0d25829",
284
  "metadata": {},
285
  "outputs": [],
 
289
  },
290
  {
291
  "cell_type": "code",
292
+ "execution_count": 52,
293
  "id": "c75b8ca4",
294
  "metadata": {},
295
  "outputs": [],
 
299
  },
300
  {
301
  "cell_type": "code",
302
+ "execution_count": 53,
303
  "id": "a1bd98e0",
304
  "metadata": {},
305
  "outputs": [
 
323
  " requires_grad=True)"
324
  ]
325
  },
326
+ "execution_count": 53,
327
  "metadata": {},
328
  "output_type": "execute_result"
329
  }
 
334
  },
335
  {
336
  "cell_type": "code",
337
+ "execution_count": 54,
338
  "id": "9a09b2fd",
339
  "metadata": {},
340
  "outputs": [
 
344
  "torch.Size([64, 3, 7, 7])"
345
  ]
346
  },
347
+ "execution_count": 54,
348
  "metadata": {},
349
  "output_type": "execute_result"
350
  }
 
355
  },
356
  {
357
  "cell_type": "code",
358
+ "execution_count": 55,
359
  "id": "a05ca56d",
360
  "metadata": {},
361
  "outputs": [
 
624
  " -7.1066e-02, -6.6630e-02]]]], requires_grad=True)"
625
  ]
626
  },
627
+ "execution_count": 55,
628
  "metadata": {},
629
  "output_type": "execute_result"
630
  }
 
643
  },
644
  {
645
  "cell_type": "code",
646
+ "execution_count": 56,
647
  "id": "416da297",
648
  "metadata": {},
649
  "outputs": [],
 
656
  },
657
  {
658
  "cell_type": "code",
659
+ "execution_count": 57,
660
  "id": "a0d2f5c6",
661
  "metadata": {},
662
  "outputs": [],
 
667
  },
668
  {
669
  "cell_type": "code",
670
+ "execution_count": 58,
671
  "id": "4d5c5a92",
672
  "metadata": {},
673
  "outputs": [],
 
678
  },
679
  {
680
  "cell_type": "code",
681
+ "execution_count": 59,
682
  "id": "3debd079",
683
  "metadata": {},
684
  "outputs": [],
app.py CHANGED
@@ -21,7 +21,7 @@ def classify_image(img):
21
  return dict(zip(categories, map(float, probs)))
22
 
23
  # %% app.ipynb 9
24
- image = gr.Image(shape=(192, 192))
25
  label = gr.Label()
26
  examples = ['dog.jpeg', 'cat.jpeg', 'bear.jpeg', 'dog2.jpeg']
27
 
 
21
  return dict(zip(categories, map(float, probs)))
22
 
23
  # %% app.ipynb 9
24
+ image = gr.Image(width=192, height=192)
25
  label = gr.Label()
26
  examples = ['dog.jpeg', 'cat.jpeg', 'bear.jpeg', 'dog2.jpeg']
27