Utkarsh736 commited on
Commit
c05f985
2 Parent(s): 814f521 e1814f8

Merge branch 'main' of https://github.com/Utkarsh736/Bearify

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. .gitconfig +11 -0
  3. Bearify_nb.ipynb +34 -16
  4. app.py +11 -3
.gitattributes CHANGED
@@ -39,3 +39,4 @@ Images/** filter=lfs diff=lfs merge=lfs -text
39
  Images/* filter=lfs diff=lfs merge=lfs -text
40
  Images/ filter=lfs diff=lfs merge=lfs -text
41
  Images/** filter=lfs diff=lfs merge=lfs -text
 
 
39
  Images/* filter=lfs diff=lfs merge=lfs -text
40
  Images/ filter=lfs diff=lfs merge=lfs -text
41
  Images/** filter=lfs diff=lfs merge=lfs -text
42
+ *.ipynb merge=nbdev-merge
.gitconfig ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generated by nbdev_install_hooks
2
+ #
3
+ # If you need to disable this instrumentation do:
4
+ # git config --local --unset include.path
5
+ #
6
+ # To restore:
7
+ # git config --local include.path ../.gitconfig
8
+ #
9
+ [merge "nbdev-merge"]
10
+ name = resolve conflicts with nbdev_fix
11
+ driver = nbdev_merge %O %A %B %P
Bearify_nb.ipynb CHANGED
@@ -35,7 +35,7 @@
35
  },
36
  {
37
  "cell_type": "code",
38
- "execution_count": 29,
39
  "metadata": {
40
  "colab": {
41
  "base_uri": "https://localhost:8080/",
@@ -53,7 +53,7 @@
53
  "PILImage mode=RGB size=192x128"
54
  ]
55
  },
56
- "execution_count": 29,
57
  "metadata": {},
58
  "output_type": "execute_result"
59
  }
@@ -66,10 +66,11 @@
66
  },
67
  {
68
  "cell_type": "code",
69
- "execution_count": 5,
70
  "metadata": {},
71
  "outputs": [],
72
  "source": [
 
73
  "import pathlib\n",
74
  "temp = pathlib.PosixPath\n",
75
  "pathlib.PosixPath = pathlib.WindowsPath"
@@ -77,7 +78,7 @@
77
  },
78
  {
79
  "cell_type": "code",
80
- "execution_count": 6,
81
  "metadata": {
82
  "id": "Ko1vxtuzACNo"
83
  },
@@ -87,6 +88,16 @@
87
  "learn = load_learner('bear_model.pkl')"
88
  ]
89
  },
 
 
 
 
 
 
 
 
 
 
90
  {
91
  "cell_type": "code",
92
  "execution_count": 7,
@@ -128,7 +139,14 @@
128
  },
129
  {
130
  "data": {
131
- "text/html": [],
 
 
 
 
 
 
 
132
  "text/plain": [
133
  "<IPython.core.display.HTML object>"
134
  ]
@@ -139,7 +157,7 @@
139
  {
140
  "data": {
141
  "text/plain": [
142
- "('teddy', tensor(2), tensor([1.0445e-04, 5.7532e-07, 9.9989e-01]))"
143
  ]
144
  },
145
  "execution_count": 7,
@@ -153,7 +171,7 @@
153
  },
154
  {
155
  "cell_type": "code",
156
- "execution_count": 26,
157
  "metadata": {
158
  "id": "k8MzL29fm5wO"
159
  },
@@ -169,7 +187,7 @@
169
  },
170
  {
171
  "cell_type": "code",
172
- "execution_count": 30,
173
  "metadata": {
174
  "colab": {
175
  "base_uri": "https://localhost:8080/",
@@ -224,7 +242,7 @@
224
  " 'Teddy': 4.94215839808021e-07}"
225
  ]
226
  },
227
- "execution_count": 30,
228
  "metadata": {},
229
  "output_type": "execute_result"
230
  }
@@ -235,7 +253,7 @@
235
  },
236
  {
237
  "cell_type": "code",
238
- "execution_count": 31,
239
  "metadata": {
240
  "colab": {
241
  "base_uri": "https://localhost:8080/",
@@ -249,7 +267,7 @@
249
  "name": "stdout",
250
  "output_type": "stream",
251
  "text": [
252
- "Running on local URL: http://127.0.0.1:7865\n",
253
  "\n",
254
  "To create a public link, set `share=True` in `launch()`.\n"
255
  ]
@@ -258,7 +276,7 @@
258
  "data": {
259
  "text/plain": []
260
  },
261
- "execution_count": 31,
262
  "metadata": {},
263
  "output_type": "execute_result"
264
  },
@@ -321,7 +339,7 @@
321
  },
322
  {
323
  "cell_type": "code",
324
- "execution_count": 35,
325
  "metadata": {},
326
  "outputs": [
327
  {
@@ -351,9 +369,9 @@
351
  "provenance": []
352
  },
353
  "kernelspec": {
354
- "display_name": "bear_env",
355
  "language": "python",
356
- "name": "bear_env"
357
  },
358
  "language_info": {
359
  "codemirror_mode": {
@@ -365,7 +383,7 @@
365
  "name": "python",
366
  "nbconvert_exporter": "python",
367
  "pygments_lexer": "ipython3",
368
- "version": "3.10.9"
369
  }
370
  },
371
  "nbformat": 4,
 
35
  },
36
  {
37
  "cell_type": "code",
38
+ "execution_count": 3,
39
  "metadata": {
40
  "colab": {
41
  "base_uri": "https://localhost:8080/",
 
53
  "PILImage mode=RGB size=192x128"
54
  ]
55
  },
56
+ "execution_count": 3,
57
  "metadata": {},
58
  "output_type": "execute_result"
59
  }
 
66
  },
67
  {
68
  "cell_type": "code",
69
+ "execution_count": 4,
70
  "metadata": {},
71
  "outputs": [],
72
  "source": [
73
+ "#|export\n",
74
  "import pathlib\n",
75
  "temp = pathlib.PosixPath\n",
76
  "pathlib.PosixPath = pathlib.WindowsPath"
 
78
  },
79
  {
80
  "cell_type": "code",
81
+ "execution_count": 5,
82
  "metadata": {
83
  "id": "Ko1vxtuzACNo"
84
  },
 
88
  "learn = load_learner('bear_model.pkl')"
89
  ]
90
  },
91
+ {
92
+ "cell_type": "code",
93
+ "execution_count": 11,
94
+ "metadata": {},
95
+ "outputs": [],
96
+ "source": [
97
+ "#|export\n",
98
+ "pathlib.PosixPath = temp"
99
+ ]
100
+ },
101
  {
102
  "cell_type": "code",
103
  "execution_count": 7,
 
139
  },
140
  {
141
  "data": {
142
+ "text/html": [
143
+ "\n",
144
+ " <div>\n",
145
+ " <progress value='0' class='' max='1' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
146
+ " 0.00% [0/1 00:00&lt;?]\n",
147
+ " </div>\n",
148
+ " "
149
+ ],
150
  "text/plain": [
151
  "<IPython.core.display.HTML object>"
152
  ]
 
157
  {
158
  "data": {
159
  "text/plain": [
160
+ "('black', tensor(0), tensor([9.9997e-01, 2.5549e-05, 4.9422e-07]))"
161
  ]
162
  },
163
  "execution_count": 7,
 
171
  },
172
  {
173
  "cell_type": "code",
174
+ "execution_count": 8,
175
  "metadata": {
176
  "id": "k8MzL29fm5wO"
177
  },
 
187
  },
188
  {
189
  "cell_type": "code",
190
+ "execution_count": 9,
191
  "metadata": {
192
  "colab": {
193
  "base_uri": "https://localhost:8080/",
 
242
  " 'Teddy': 4.94215839808021e-07}"
243
  ]
244
  },
245
+ "execution_count": 9,
246
  "metadata": {},
247
  "output_type": "execute_result"
248
  }
 
253
  },
254
  {
255
  "cell_type": "code",
256
+ "execution_count": null,
257
  "metadata": {
258
  "colab": {
259
  "base_uri": "https://localhost:8080/",
 
267
  "name": "stdout",
268
  "output_type": "stream",
269
  "text": [
270
+ "Running on local URL: http://127.0.0.1:7860\n",
271
  "\n",
272
  "To create a public link, set `share=True` in `launch()`.\n"
273
  ]
 
276
  "data": {
277
  "text/plain": []
278
  },
279
+ "execution_count": 10,
280
  "metadata": {},
281
  "output_type": "execute_result"
282
  },
 
339
  },
340
  {
341
  "cell_type": "code",
342
+ "execution_count": 12,
343
  "metadata": {},
344
  "outputs": [
345
  {
 
369
  "provenance": []
370
  },
371
  "kernelspec": {
372
+ "display_name": "bear_gh_env",
373
  "language": "python",
374
+ "name": "python3"
375
  },
376
  "language_info": {
377
  "codemirror_mode": {
 
383
  "name": "python",
384
  "nbconvert_exporter": "python",
385
  "pygments_lexer": "ipython3",
386
+ "version": "3.11.9"
387
  }
388
  },
389
  "nbformat": 4,
app.py CHANGED
@@ -1,23 +1,31 @@
1
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../Bearify_nb.ipynb.
2
 
3
  # %% auto 0
4
- __all__ = ['learn', 'categories', 'image', 'labels', 'examples', 'intf', 'classify_image']
5
 
6
  # %% ../Bearify_nb.ipynb 2
7
  from fastai.vision.all import *
8
  import gradio as gr
9
 
 
 
 
 
 
10
  # %% ../Bearify_nb.ipynb 5
11
  learn = load_learner('bear_model.pkl')
12
 
13
- # %% ../Bearify_nb.ipynb 7
 
 
 
14
  categories = ('Black', 'Grizzly', 'Teddy')
15
 
16
  def classify_image(img):
17
  pred, idx, probs = learn.predict(img)
18
  return dict(zip(categories, map(float, probs)))
19
 
20
- # %% ../Bearify_nb.ipynb 9
21
  image = gr.Image()
22
  labels = gr.Label()
23
  examples = ['Images/teddy.jpg', 'Images/grizzly.jpg', 'Images/black.jpeg']
 
1
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../Bearify_nb.ipynb.
2
 
3
  # %% auto 0
4
+ __all__ = ['temp', 'learn', 'categories', 'image', 'labels', 'examples', 'intf', 'classify_image']
5
 
6
  # %% ../Bearify_nb.ipynb 2
7
  from fastai.vision.all import *
8
  import gradio as gr
9
 
10
+ # %% ../Bearify_nb.ipynb 4
11
+ import pathlib
12
+ temp = pathlib.PosixPath
13
+ pathlib.PosixPath = pathlib.WindowsPath
14
+
15
  # %% ../Bearify_nb.ipynb 5
16
  learn = load_learner('bear_model.pkl')
17
 
18
+ # %% ../Bearify_nb.ipynb 6
19
+ pathlib.PosixPath = temp
20
+
21
+ # %% ../Bearify_nb.ipynb 8
22
  categories = ('Black', 'Grizzly', 'Teddy')
23
 
24
  def classify_image(img):
25
  pred, idx, probs = learn.predict(img)
26
  return dict(zip(categories, map(float, probs)))
27
 
28
+ # %% ../Bearify_nb.ipynb 10
29
  image = gr.Image()
30
  labels = gr.Label()
31
  examples = ['Images/teddy.jpg', 'Images/grizzly.jpg', 'Images/black.jpeg']