RaviRaj988 commited on
Commit
62a69b4
1 Parent(s): 9062980

cat dog fix

Browse files
Files changed (2) hide show
  1. app.ipynb +49 -17
  2. app.py +1 -1
app.ipynb CHANGED
@@ -3,7 +3,7 @@
3
  {
4
  "cell_type": "code",
5
  "execution_count": 1,
6
- "id": "61d35bad",
7
  "metadata": {},
8
  "outputs": [],
9
  "source": [
@@ -15,7 +15,7 @@
15
  {
16
  "cell_type": "code",
17
  "execution_count": 23,
18
- "id": "e6a6be00",
19
  "metadata": {},
20
  "outputs": [
21
  {
@@ -36,7 +36,7 @@
36
  {
37
  "cell_type": "code",
38
  "execution_count": 11,
39
- "id": "7686f783",
40
  "metadata": {},
41
  "outputs": [],
42
  "source": [
@@ -46,7 +46,7 @@
46
  {
47
  "cell_type": "code",
48
  "execution_count": 12,
49
- "id": "87ad84f9",
50
  "metadata": {},
51
  "outputs": [
52
  {
@@ -67,7 +67,7 @@
67
  {
68
  "cell_type": "code",
69
  "execution_count": 13,
70
- "id": "d97bef6b",
71
  "metadata": {},
72
  "outputs": [],
73
  "source": [
@@ -77,7 +77,7 @@
77
  {
78
  "cell_type": "code",
79
  "execution_count": 14,
80
- "id": "b12482d2",
81
  "metadata": {},
82
  "outputs": [
83
  {
@@ -98,7 +98,7 @@
98
  {
99
  "cell_type": "code",
100
  "execution_count": 16,
101
- "id": "78294788",
102
  "metadata": {},
103
  "outputs": [],
104
  "source": [
@@ -109,7 +109,7 @@
109
  {
110
  "cell_type": "code",
111
  "execution_count": 19,
112
- "id": "b041d6c6",
113
  "metadata": {},
114
  "outputs": [],
115
  "source": [
@@ -128,7 +128,7 @@
128
  {
129
  "cell_type": "code",
130
  "execution_count": 20,
131
- "id": "afa3cd9e",
132
  "metadata": {},
133
  "outputs": [
134
  {
@@ -149,7 +149,7 @@
149
  {
150
  "cell_type": "code",
151
  "execution_count": 21,
152
- "id": "5ac8c0b8",
153
  "metadata": {},
154
  "outputs": [
155
  {
@@ -170,7 +170,7 @@
170
  {
171
  "cell_type": "code",
172
  "execution_count": 24,
173
- "id": "f12019b5",
174
  "metadata": {},
175
  "outputs": [
176
  {
@@ -311,7 +311,7 @@
311
  {
312
  "cell_type": "code",
313
  "execution_count": 25,
314
- "id": "baeac351",
315
  "metadata": {},
316
  "outputs": [],
317
  "source": [
@@ -321,17 +321,49 @@
321
  {
322
  "cell_type": "code",
323
  "execution_count": 26,
324
- "id": "66a39511",
325
  "metadata": {},
326
  "outputs": [],
327
  "source": [
328
  "l=load_learner('model.pkl')"
329
  ]
330
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  {
332
  "cell_type": "code",
333
  "execution_count": 27,
334
- "id": "dc54ece1",
335
  "metadata": {},
336
  "outputs": [],
337
  "source": [
@@ -344,7 +376,7 @@
344
  {
345
  "cell_type": "code",
346
  "execution_count": 29,
347
- "id": "ce096d4b",
348
  "metadata": {},
349
  "outputs": [
350
  {
@@ -421,14 +453,14 @@
421
  "source": [
422
  "image=gr.inputs.Image(shape=(192,192))\n",
423
  "label=gr.outputs.Label()\n",
424
- "inf=gr.Interface(fn=classify,inputs=image,outputs=label)\n",
425
  "inf.launch(inline=False)"
426
  ]
427
  },
428
  {
429
  "cell_type": "code",
430
  "execution_count": null,
431
- "id": "6a08f7e4",
432
  "metadata": {},
433
  "outputs": [],
434
  "source": []
 
3
  {
4
  "cell_type": "code",
5
  "execution_count": 1,
6
+ "id": "63954aab",
7
  "metadata": {},
8
  "outputs": [],
9
  "source": [
 
15
  {
16
  "cell_type": "code",
17
  "execution_count": 23,
18
+ "id": "55f211ba",
19
  "metadata": {},
20
  "outputs": [
21
  {
 
36
  {
37
  "cell_type": "code",
38
  "execution_count": 11,
39
+ "id": "03b6a602",
40
  "metadata": {},
41
  "outputs": [],
42
  "source": [
 
46
  {
47
  "cell_type": "code",
48
  "execution_count": 12,
49
+ "id": "79eb2363",
50
  "metadata": {},
51
  "outputs": [
52
  {
 
67
  {
68
  "cell_type": "code",
69
  "execution_count": 13,
70
+ "id": "55a7aa21",
71
  "metadata": {},
72
  "outputs": [],
73
  "source": [
 
77
  {
78
  "cell_type": "code",
79
  "execution_count": 14,
80
+ "id": "22e702f7",
81
  "metadata": {},
82
  "outputs": [
83
  {
 
98
  {
99
  "cell_type": "code",
100
  "execution_count": 16,
101
+ "id": "7af4b7e0",
102
  "metadata": {},
103
  "outputs": [],
104
  "source": [
 
109
  {
110
  "cell_type": "code",
111
  "execution_count": 19,
112
+ "id": "bf119685",
113
  "metadata": {},
114
  "outputs": [],
115
  "source": [
 
128
  {
129
  "cell_type": "code",
130
  "execution_count": 20,
131
+ "id": "bab7c7aa",
132
  "metadata": {},
133
  "outputs": [
134
  {
 
149
  {
150
  "cell_type": "code",
151
  "execution_count": 21,
152
+ "id": "4047a238",
153
  "metadata": {},
154
  "outputs": [
155
  {
 
170
  {
171
  "cell_type": "code",
172
  "execution_count": 24,
173
+ "id": "2d2a09b4",
174
  "metadata": {},
175
  "outputs": [
176
  {
 
311
  {
312
  "cell_type": "code",
313
  "execution_count": 25,
314
+ "id": "661b3f97",
315
  "metadata": {},
316
  "outputs": [],
317
  "source": [
 
321
  {
322
  "cell_type": "code",
323
  "execution_count": 26,
324
+ "id": "dacbe39b",
325
  "metadata": {},
326
  "outputs": [],
327
  "source": [
328
  "l=load_learner('model.pkl')"
329
  ]
330
  },
331
+ {
332
+ "cell_type": "code",
333
+ "execution_count": 31,
334
+ "id": "5e606ed9",
335
+ "metadata": {},
336
+ "outputs": [],
337
+ "source": [
338
+ "PILImage.create('dog.jpg')"
339
+ ]
340
+ },
341
+ {
342
+ "cell_type": "code",
343
+ "execution_count": 30,
344
+ "id": "569c3b37",
345
+ "metadata": {},
346
+ "outputs": [
347
+ {
348
+ "ename": "NameError",
349
+ "evalue": "name 'img' is not defined",
350
+ "output_type": "error",
351
+ "traceback": [
352
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
353
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
354
+ "Input \u001b[0;32mIn [30]\u001b[0m, in \u001b[0;36m<cell line: 1>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0m l\u001b[38;5;241m.\u001b[39mpredict(\u001b[43mimg\u001b[49m)\n",
355
+ "\u001b[0;31mNameError\u001b[0m: name 'img' is not defined"
356
+ ]
357
+ }
358
+ ],
359
+ "source": [
360
+ "l.predict(img)"
361
+ ]
362
+ },
363
  {
364
  "cell_type": "code",
365
  "execution_count": 27,
366
+ "id": "b107483d",
367
  "metadata": {},
368
  "outputs": [],
369
  "source": [
 
376
  {
377
  "cell_type": "code",
378
  "execution_count": 29,
379
+ "id": "e9178a7d",
380
  "metadata": {},
381
  "outputs": [
382
  {
 
453
  "source": [
454
  "image=gr.inputs.Image(shape=(192,192))\n",
455
  "label=gr.outputs.Label()\n",
456
+ "inf=gr.Interface(fn=classify,inputs=image,outputs=label,)\n",
457
  "inf.launch(inline=False)"
458
  ]
459
  },
460
  {
461
  "cell_type": "code",
462
  "execution_count": null,
463
+ "id": "8689a0e8",
464
  "metadata": {},
465
  "outputs": [],
466
  "source": []
app.py CHANGED
@@ -8,7 +8,7 @@ def is_cat(x): return x[0].isupper()
8
 
9
  l=load_learner('model.pkl')
10
 
11
- cat=('cat','dog')
12
  def classify(img):
13
  s,i,p=l.predict(img)
14
  return dict(zip(cat,map(float,p)))
 
8
 
9
  l=load_learner('model.pkl')
10
 
11
+ cat=('dog','cat')
12
  def classify(img):
13
  s,i,p=l.predict(img)
14
  return dict(zip(cat,map(float,p)))