Spaces:
Runtime error
Runtime error
Oleh Hnashuk
commited on
Commit
•
734a5c5
1
Parent(s):
1f46772
updated category labels
Browse files
app.ipynb
CHANGED
@@ -35,14 +35,14 @@
|
|
35 |
},
|
36 |
{
|
37 |
"cell_type": "code",
|
38 |
-
"execution_count":
|
39 |
"id": "d9019a15",
|
40 |
"metadata": {},
|
41 |
"outputs": [],
|
42 |
"source": [
|
43 |
"#|export \n",
|
44 |
"\n",
|
45 |
-
"categories = ('bird
|
46 |
"\n",
|
47 |
"def classify_image(img):\n",
|
48 |
" pred, idx, probs = learn.predict(img)\n",
|
@@ -51,7 +51,7 @@
|
|
51 |
},
|
52 |
{
|
53 |
"cell_type": "code",
|
54 |
-
"execution_count":
|
55 |
"id": "d04d8882",
|
56 |
"metadata": {},
|
57 |
"outputs": [
|
@@ -95,12 +95,12 @@
|
|
95 |
{
|
96 |
"data": {
|
97 |
"text/plain": [
|
98 |
-
"{'bird
|
99 |
-
" 'fish
|
100 |
-
" 'mammal
|
101 |
]
|
102 |
},
|
103 |
-
"execution_count":
|
104 |
"metadata": {},
|
105 |
"output_type": "execute_result"
|
106 |
}
|
@@ -112,7 +112,7 @@
|
|
112 |
},
|
113 |
{
|
114 |
"cell_type": "code",
|
115 |
-
"execution_count":
|
116 |
"id": "bbef2af6",
|
117 |
"metadata": {},
|
118 |
"outputs": [
|
@@ -134,7 +134,7 @@
|
|
134 |
"name": "stdout",
|
135 |
"output_type": "stream",
|
136 |
"text": [
|
137 |
-
"Running on local URL: http://127.0.0.1:
|
138 |
"\n",
|
139 |
"To create a public link, set `share=True` in `launch()`.\n"
|
140 |
]
|
@@ -143,120 +143,9 @@
|
|
143 |
"data": {
|
144 |
"text/plain": []
|
145 |
},
|
146 |
-
"execution_count":
|
147 |
"metadata": {},
|
148 |
"output_type": "execute_result"
|
149 |
-
},
|
150 |
-
{
|
151 |
-
"data": {
|
152 |
-
"text/html": [
|
153 |
-
"\n",
|
154 |
-
"<style>\n",
|
155 |
-
" /* Turns off some styling */\n",
|
156 |
-
" progress {\n",
|
157 |
-
" /* gets rid of default border in Firefox and Opera. */\n",
|
158 |
-
" border: none;\n",
|
159 |
-
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
160 |
-
" background-size: auto;\n",
|
161 |
-
" }\n",
|
162 |
-
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
163 |
-
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
164 |
-
" }\n",
|
165 |
-
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
166 |
-
" background: #F44336;\n",
|
167 |
-
" }\n",
|
168 |
-
"</style>\n"
|
169 |
-
],
|
170 |
-
"text/plain": [
|
171 |
-
"<IPython.core.display.HTML object>"
|
172 |
-
]
|
173 |
-
},
|
174 |
-
"metadata": {},
|
175 |
-
"output_type": "display_data"
|
176 |
-
},
|
177 |
-
{
|
178 |
-
"data": {
|
179 |
-
"text/html": [],
|
180 |
-
"text/plain": [
|
181 |
-
"<IPython.core.display.HTML object>"
|
182 |
-
]
|
183 |
-
},
|
184 |
-
"metadata": {},
|
185 |
-
"output_type": "display_data"
|
186 |
-
},
|
187 |
-
{
|
188 |
-
"data": {
|
189 |
-
"text/html": [
|
190 |
-
"\n",
|
191 |
-
"<style>\n",
|
192 |
-
" /* Turns off some styling */\n",
|
193 |
-
" progress {\n",
|
194 |
-
" /* gets rid of default border in Firefox and Opera. */\n",
|
195 |
-
" border: none;\n",
|
196 |
-
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
197 |
-
" background-size: auto;\n",
|
198 |
-
" }\n",
|
199 |
-
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
200 |
-
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
201 |
-
" }\n",
|
202 |
-
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
203 |
-
" background: #F44336;\n",
|
204 |
-
" }\n",
|
205 |
-
"</style>\n"
|
206 |
-
],
|
207 |
-
"text/plain": [
|
208 |
-
"<IPython.core.display.HTML object>"
|
209 |
-
]
|
210 |
-
},
|
211 |
-
"metadata": {},
|
212 |
-
"output_type": "display_data"
|
213 |
-
},
|
214 |
-
{
|
215 |
-
"data": {
|
216 |
-
"text/html": [],
|
217 |
-
"text/plain": [
|
218 |
-
"<IPython.core.display.HTML object>"
|
219 |
-
]
|
220 |
-
},
|
221 |
-
"metadata": {},
|
222 |
-
"output_type": "display_data"
|
223 |
-
},
|
224 |
-
{
|
225 |
-
"data": {
|
226 |
-
"text/html": [
|
227 |
-
"\n",
|
228 |
-
"<style>\n",
|
229 |
-
" /* Turns off some styling */\n",
|
230 |
-
" progress {\n",
|
231 |
-
" /* gets rid of default border in Firefox and Opera. */\n",
|
232 |
-
" border: none;\n",
|
233 |
-
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
234 |
-
" background-size: auto;\n",
|
235 |
-
" }\n",
|
236 |
-
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
237 |
-
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
238 |
-
" }\n",
|
239 |
-
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
240 |
-
" background: #F44336;\n",
|
241 |
-
" }\n",
|
242 |
-
"</style>\n"
|
243 |
-
],
|
244 |
-
"text/plain": [
|
245 |
-
"<IPython.core.display.HTML object>"
|
246 |
-
]
|
247 |
-
},
|
248 |
-
"metadata": {},
|
249 |
-
"output_type": "display_data"
|
250 |
-
},
|
251 |
-
{
|
252 |
-
"data": {
|
253 |
-
"text/html": [],
|
254 |
-
"text/plain": [
|
255 |
-
"<IPython.core.display.HTML object>"
|
256 |
-
]
|
257 |
-
},
|
258 |
-
"metadata": {},
|
259 |
-
"output_type": "display_data"
|
260 |
}
|
261 |
],
|
262 |
"source": [
|
@@ -271,7 +160,7 @@
|
|
271 |
},
|
272 |
{
|
273 |
"cell_type": "code",
|
274 |
-
"execution_count":
|
275 |
"id": "c0c533db",
|
276 |
"metadata": {},
|
277 |
"outputs": [],
|
|
|
35 |
},
|
36 |
{
|
37 |
"cell_type": "code",
|
38 |
+
"execution_count": 58,
|
39 |
"id": "d9019a15",
|
40 |
"metadata": {},
|
41 |
"outputs": [],
|
42 |
"source": [
|
43 |
"#|export \n",
|
44 |
"\n",
|
45 |
+
"categories = ('bird', 'fish', 'mammal')\n",
|
46 |
"\n",
|
47 |
"def classify_image(img):\n",
|
48 |
" pred, idx, probs = learn.predict(img)\n",
|
|
|
51 |
},
|
52 |
{
|
53 |
"cell_type": "code",
|
54 |
+
"execution_count": 59,
|
55 |
"id": "d04d8882",
|
56 |
"metadata": {},
|
57 |
"outputs": [
|
|
|
95 |
{
|
96 |
"data": {
|
97 |
"text/plain": [
|
98 |
+
"{'bird': 1.5930112567730248e-05,\n",
|
99 |
+
" 'fish': 0.9999780654907227,\n",
|
100 |
+
" 'mammal': 5.961885563010583e-06}"
|
101 |
]
|
102 |
},
|
103 |
+
"execution_count": 59,
|
104 |
"metadata": {},
|
105 |
"output_type": "execute_result"
|
106 |
}
|
|
|
112 |
},
|
113 |
{
|
114 |
"cell_type": "code",
|
115 |
+
"execution_count": 60,
|
116 |
"id": "bbef2af6",
|
117 |
"metadata": {},
|
118 |
"outputs": [
|
|
|
134 |
"name": "stdout",
|
135 |
"output_type": "stream",
|
136 |
"text": [
|
137 |
+
"Running on local URL: http://127.0.0.1:7865\n",
|
138 |
"\n",
|
139 |
"To create a public link, set `share=True` in `launch()`.\n"
|
140 |
]
|
|
|
143 |
"data": {
|
144 |
"text/plain": []
|
145 |
},
|
146 |
+
"execution_count": 60,
|
147 |
"metadata": {},
|
148 |
"output_type": "execute_result"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
}
|
150 |
],
|
151 |
"source": [
|
|
|
160 |
},
|
161 |
{
|
162 |
"cell_type": "code",
|
163 |
+
"execution_count": 61,
|
164 |
"id": "c0c533db",
|
165 |
"metadata": {},
|
166 |
"outputs": [],
|
app.py
CHANGED
@@ -11,7 +11,7 @@ import gradio as gr
|
|
11 |
learn = load_learner('model.pk1')
|
12 |
|
13 |
# %% ../app.ipynb 3
|
14 |
-
categories = ('bird
|
15 |
|
16 |
def classify_image(img):
|
17 |
pred, idx, probs = learn.predict(img)
|
|
|
11 |
learn = load_learner('model.pk1')
|
12 |
|
13 |
# %% ../app.ipynb 3
|
14 |
+
categories = ('bird', 'fish', 'mammal')
|
15 |
|
16 |
def classify_image(img):
|
17 |
pred, idx, probs = learn.predict(img)
|