CasonMizu commited on
Commit
fa88298
1 Parent(s): b3c0745

solving pathlib platform system

Browse files
Files changed (3) hide show
  1. app.ipynb +21 -28
  2. app.py +3 -3
  3. app/app.py +3 -3
app.ipynb CHANGED
@@ -9,7 +9,7 @@
9
  },
10
  {
11
  "cell_type": "code",
12
- "execution_count": 23,
13
  "metadata": {},
14
  "outputs": [],
15
  "source": [
@@ -24,7 +24,7 @@
24
  },
25
  {
26
  "cell_type": "code",
27
- "execution_count": 24,
28
  "metadata": {},
29
  "outputs": [
30
  {
@@ -35,7 +35,7 @@
35
  "PILImage mode=RGB size=144x192"
36
  ]
37
  },
38
- "execution_count": 24,
39
  "metadata": {},
40
  "output_type": "execute_result"
41
  }
@@ -48,22 +48,22 @@
48
  },
49
  {
50
  "cell_type": "code",
51
- "execution_count": 25,
52
  "metadata": {},
53
  "outputs": [],
54
  "source": [
55
  "#|export\n",
56
  "\n",
57
  "import pathlib\n",
58
- "temp = pathlib.PosixPath\n",
59
- "pathlib.PosixPath = pathlib.WindowsPath\n",
60
  "\n",
61
  "learn = load_learner('model.pkl')"
62
  ]
63
  },
64
  {
65
  "cell_type": "code",
66
- "execution_count": 26,
67
  "metadata": {},
68
  "outputs": [
69
  {
@@ -95,14 +95,7 @@
95
  },
96
  {
97
  "data": {
98
- "text/html": [
99
- "\n",
100
- " <div>\n",
101
- " <progress value='0' class='' max='1' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
102
- " 0.00% [0/1 00:00&lt;?]\n",
103
- " </div>\n",
104
- " "
105
- ],
106
  "text/plain": [
107
  "<IPython.core.display.HTML object>"
108
  ]
@@ -116,7 +109,7 @@
116
  "('False', tensor(0), tensor([0.9858, 0.0142]))"
117
  ]
118
  },
119
- "execution_count": 26,
120
  "metadata": {},
121
  "output_type": "execute_result"
122
  }
@@ -127,7 +120,7 @@
127
  },
128
  {
129
  "cell_type": "code",
130
- "execution_count": 27,
131
  "metadata": {},
132
  "outputs": [],
133
  "source": [
@@ -141,7 +134,7 @@
141
  },
142
  {
143
  "cell_type": "code",
144
- "execution_count": 28,
145
  "metadata": {},
146
  "outputs": [
147
  {
@@ -187,7 +180,7 @@
187
  "{'Dog': 0.9858279228210449, 'Cat': 0.01417205948382616}"
188
  ]
189
  },
190
- "execution_count": 28,
191
  "metadata": {},
192
  "output_type": "execute_result"
193
  }
@@ -198,15 +191,15 @@
198
  },
199
  {
200
  "cell_type": "code",
201
- "execution_count": 29,
202
  "metadata": {},
203
  "outputs": [
204
  {
205
  "name": "stdout",
206
  "output_type": "stream",
207
  "text": [
208
- "Running on local URL: http://127.0.0.1:7865\n",
209
- "Running on public URL: https://700720f52cb98fbeb0.gradio.live\n",
210
  "\n",
211
  "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n"
212
  ]
@@ -215,7 +208,7 @@
215
  "data": {
216
  "text/plain": []
217
  },
218
- "execution_count": 29,
219
  "metadata": {},
220
  "output_type": "execute_result"
221
  }
@@ -233,7 +226,7 @@
233
  },
234
  {
235
  "cell_type": "code",
236
- "execution_count": 30,
237
  "metadata": {},
238
  "outputs": [],
239
  "source": [
@@ -242,7 +235,7 @@
242
  },
243
  {
244
  "cell_type": "code",
245
- "execution_count": 31,
246
  "metadata": {},
247
  "outputs": [],
248
  "source": [
@@ -251,7 +244,7 @@
251
  },
252
  {
253
  "cell_type": "code",
254
- "execution_count": 32,
255
  "metadata": {},
256
  "outputs": [
257
  {
@@ -274,7 +267,7 @@
274
  " requires_grad=True)"
275
  ]
276
  },
277
- "execution_count": 32,
278
  "metadata": {},
279
  "output_type": "execute_result"
280
  }
@@ -297,7 +290,7 @@
297
  },
298
  {
299
  "cell_type": "code",
300
- "execution_count": 33,
301
  "metadata": {},
302
  "outputs": [
303
  {
 
9
  },
10
  {
11
  "cell_type": "code",
12
+ "execution_count": 1,
13
  "metadata": {},
14
  "outputs": [],
15
  "source": [
 
24
  },
25
  {
26
  "cell_type": "code",
27
+ "execution_count": 2,
28
  "metadata": {},
29
  "outputs": [
30
  {
 
35
  "PILImage mode=RGB size=144x192"
36
  ]
37
  },
38
+ "execution_count": 2,
39
  "metadata": {},
40
  "output_type": "execute_result"
41
  }
 
48
  },
49
  {
50
  "cell_type": "code",
51
+ "execution_count": 3,
52
  "metadata": {},
53
  "outputs": [],
54
  "source": [
55
  "#|export\n",
56
  "\n",
57
  "import pathlib\n",
58
+ "plt = platform.system()\n",
59
+ "if plt == 'Windows': pathlib.PosixPath = pathlib.WindowsPath\n",
60
  "\n",
61
  "learn = load_learner('model.pkl')"
62
  ]
63
  },
64
  {
65
  "cell_type": "code",
66
+ "execution_count": 4,
67
  "metadata": {},
68
  "outputs": [
69
  {
 
95
  },
96
  {
97
  "data": {
98
+ "text/html": [],
 
 
 
 
 
 
 
99
  "text/plain": [
100
  "<IPython.core.display.HTML object>"
101
  ]
 
109
  "('False', tensor(0), tensor([0.9858, 0.0142]))"
110
  ]
111
  },
112
+ "execution_count": 4,
113
  "metadata": {},
114
  "output_type": "execute_result"
115
  }
 
120
  },
121
  {
122
  "cell_type": "code",
123
+ "execution_count": 5,
124
  "metadata": {},
125
  "outputs": [],
126
  "source": [
 
134
  },
135
  {
136
  "cell_type": "code",
137
+ "execution_count": 6,
138
  "metadata": {},
139
  "outputs": [
140
  {
 
180
  "{'Dog': 0.9858279228210449, 'Cat': 0.01417205948382616}"
181
  ]
182
  },
183
+ "execution_count": 6,
184
  "metadata": {},
185
  "output_type": "execute_result"
186
  }
 
191
  },
192
  {
193
  "cell_type": "code",
194
+ "execution_count": 7,
195
  "metadata": {},
196
  "outputs": [
197
  {
198
  "name": "stdout",
199
  "output_type": "stream",
200
  "text": [
201
+ "Running on local URL: http://127.0.0.1:7860\n",
202
+ "Running on public URL: https://959b4f16bef7ca2aae.gradio.live\n",
203
  "\n",
204
  "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n"
205
  ]
 
208
  "data": {
209
  "text/plain": []
210
  },
211
+ "execution_count": 7,
212
  "metadata": {},
213
  "output_type": "execute_result"
214
  }
 
226
  },
227
  {
228
  "cell_type": "code",
229
+ "execution_count": 8,
230
  "metadata": {},
231
  "outputs": [],
232
  "source": [
 
235
  },
236
  {
237
  "cell_type": "code",
238
+ "execution_count": 9,
239
  "metadata": {},
240
  "outputs": [],
241
  "source": [
 
244
  },
245
  {
246
  "cell_type": "code",
247
+ "execution_count": 10,
248
  "metadata": {},
249
  "outputs": [
250
  {
 
267
  " requires_grad=True)"
268
  ]
269
  },
270
+ "execution_count": 10,
271
  "metadata": {},
272
  "output_type": "execute_result"
273
  }
 
290
  },
291
  {
292
  "cell_type": "code",
293
+ "execution_count": 11,
294
  "metadata": {},
295
  "outputs": [
296
  {
app.py CHANGED
@@ -1,7 +1,7 @@
1
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
2
 
3
  # %% auto 0
4
- __all__ = ['temp', 'learn', 'categories', 'image', 'label', 'examples', 'intf', 'is_cat', 'classify_image']
5
 
6
  # %% ../app.ipynb 1
7
  # creating a python image library from the image
@@ -12,8 +12,8 @@ def is_cat(x): return x[0].isupper()
12
 
13
  # %% ../app.ipynb 3
14
  import pathlib
15
- temp = pathlib.PosixPath
16
- pathlib.PosixPath = pathlib.WindowsPath
17
 
18
  learn = load_learner('model.pkl')
19
 
 
1
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
2
 
3
  # %% auto 0
4
+ __all__ = ['plt', 'learn', 'categories', 'image', 'label', 'examples', 'intf', 'is_cat', 'classify_image']
5
 
6
  # %% ../app.ipynb 1
7
  # creating a python image library from the image
 
12
 
13
  # %% ../app.ipynb 3
14
  import pathlib
15
+ plt = platform.system()
16
+ if plt == 'Windows': pathlib.PosixPath = pathlib.WindowsPath
17
 
18
  learn = load_learner('model.pkl')
19
 
app/app.py CHANGED
@@ -1,7 +1,7 @@
1
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
2
 
3
  # %% auto 0
4
- __all__ = ['temp', 'learn', 'categories', 'image', 'label', 'examples', 'intf', 'is_cat', 'classify_image']
5
 
6
  # %% ../app.ipynb 1
7
  # creating a python image library from the image
@@ -12,8 +12,8 @@ def is_cat(x): return x[0].isupper()
12
 
13
  # %% ../app.ipynb 3
14
  import pathlib
15
- temp = pathlib.PosixPath
16
- pathlib.PosixPath = pathlib.WindowsPath
17
 
18
  learn = load_learner('model.pkl')
19
 
 
1
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
2
 
3
  # %% auto 0
4
+ __all__ = ['plt', 'learn', 'categories', 'image', 'label', 'examples', 'intf', 'is_cat', 'classify_image']
5
 
6
  # %% ../app.ipynb 1
7
  # creating a python image library from the image
 
12
 
13
  # %% ../app.ipynb 3
14
  import pathlib
15
+ plt = platform.system()
16
+ if plt == 'Windows': pathlib.PosixPath = pathlib.WindowsPath
17
 
18
  learn = load_learner('model.pkl')
19