Spaces:
Sleeping
Sleeping
Commit ·
34fe474
1
Parent(s): e258662
Removed deprecated `inputs` and `outputs`
Browse files- app.py +2 -2
- pets.ipynb +93 -85
app.py
CHANGED
|
@@ -25,8 +25,8 @@ def classify_image(img):
|
|
| 25 |
return dict(zip(categories, map(float, probs)))
|
| 26 |
|
| 27 |
|
| 28 |
-
image = gr.
|
| 29 |
-
label = gr.
|
| 30 |
examples = ['dog.jpeg', 'cat.jpeg', 'wot.jpeg']
|
| 31 |
|
| 32 |
|
|
|
|
| 25 |
return dict(zip(categories, map(float, probs)))
|
| 26 |
|
| 27 |
|
| 28 |
+
image = gr.Image(shape=(192, 192))
|
| 29 |
+
label = gr.Label()
|
| 30 |
examples = ['dog.jpeg', 'cat.jpeg', 'wot.jpeg']
|
| 31 |
|
| 32 |
|
pets.ipynb
CHANGED
|
@@ -9,7 +9,7 @@
|
|
| 9 |
},
|
| 10 |
{
|
| 11 |
"cell_type": "code",
|
| 12 |
-
"execution_count":
|
| 13 |
"metadata": {},
|
| 14 |
"outputs": [],
|
| 15 |
"source": [
|
|
@@ -24,7 +24,7 @@
|
|
| 24 |
},
|
| 25 |
{
|
| 26 |
"cell_type": "code",
|
| 27 |
-
"execution_count":
|
| 28 |
"metadata": {},
|
| 29 |
"outputs": [
|
| 30 |
{
|
|
@@ -35,7 +35,7 @@
|
|
| 35 |
"PILImage mode=RGB size=192x108"
|
| 36 |
]
|
| 37 |
},
|
| 38 |
-
"execution_count":
|
| 39 |
"metadata": {},
|
| 40 |
"output_type": "execute_result"
|
| 41 |
}
|
|
@@ -48,7 +48,7 @@
|
|
| 48 |
},
|
| 49 |
{
|
| 50 |
"cell_type": "code",
|
| 51 |
-
"execution_count":
|
| 52 |
"metadata": {},
|
| 53 |
"outputs": [],
|
| 54 |
"source": [
|
|
@@ -58,7 +58,7 @@
|
|
| 58 |
},
|
| 59 |
{
|
| 60 |
"cell_type": "code",
|
| 61 |
-
"execution_count":
|
| 62 |
"metadata": {},
|
| 63 |
"outputs": [
|
| 64 |
{
|
|
@@ -104,7 +104,7 @@
|
|
| 104 |
"('False', tensor(0), tensor([1.0000e+00, 9.8498e-07]))"
|
| 105 |
]
|
| 106 |
},
|
| 107 |
-
"execution_count":
|
| 108 |
"metadata": {},
|
| 109 |
"output_type": "execute_result"
|
| 110 |
}
|
|
@@ -115,7 +115,7 @@
|
|
| 115 |
},
|
| 116 |
{
|
| 117 |
"cell_type": "code",
|
| 118 |
-
"execution_count":
|
| 119 |
"metadata": {},
|
| 120 |
"outputs": [],
|
| 121 |
"source": [
|
|
@@ -129,7 +129,7 @@
|
|
| 129 |
},
|
| 130 |
{
|
| 131 |
"cell_type": "code",
|
| 132 |
-
"execution_count":
|
| 133 |
"metadata": {},
|
| 134 |
"outputs": [
|
| 135 |
{
|
|
@@ -161,7 +161,14 @@
|
|
| 161 |
},
|
| 162 |
{
|
| 163 |
"data": {
|
| 164 |
-
"text/html": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
"text/plain": [
|
| 166 |
"<IPython.core.display.HTML object>"
|
| 167 |
]
|
|
@@ -175,7 +182,7 @@
|
|
| 175 |
"{'Dog': 0.9999990463256836, 'Cat': 9.849827620200813e-07}"
|
| 176 |
]
|
| 177 |
},
|
| 178 |
-
"execution_count":
|
| 179 |
"metadata": {},
|
| 180 |
"output_type": "execute_result"
|
| 181 |
}
|
|
@@ -186,23 +193,9 @@
|
|
| 186 |
},
|
| 187 |
{
|
| 188 |
"cell_type": "code",
|
| 189 |
-
"execution_count":
|
| 190 |
"metadata": {},
|
| 191 |
"outputs": [
|
| 192 |
-
{
|
| 193 |
-
"name": "stderr",
|
| 194 |
-
"output_type": "stream",
|
| 195 |
-
"text": [
|
| 196 |
-
"/var/folders/23/fchp9d7d3zs1g2bfgb98hns80000gn/T/ipykernel_57597/1476562385.py:2: GradioDeprecationWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n",
|
| 197 |
-
" image = gr.inputs.Image(shape=(192, 192))\n",
|
| 198 |
-
"/var/folders/23/fchp9d7d3zs1g2bfgb98hns80000gn/T/ipykernel_57597/1476562385.py:2: GradioDeprecationWarning: `optional` parameter is deprecated, and it has no effect\n",
|
| 199 |
-
" image = gr.inputs.Image(shape=(192, 192))\n",
|
| 200 |
-
"/var/folders/23/fchp9d7d3zs1g2bfgb98hns80000gn/T/ipykernel_57597/1476562385.py:3: GradioDeprecationWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\n",
|
| 201 |
-
" label = gr.outputs.Label()\n",
|
| 202 |
-
"/var/folders/23/fchp9d7d3zs1g2bfgb98hns80000gn/T/ipykernel_57597/1476562385.py:3: GradioUnusedKwargWarning: You have unused kwarg parameters in Label, please remove them: {'type': 'auto'}\n",
|
| 203 |
-
" label = gr.outputs.Label()\n"
|
| 204 |
-
]
|
| 205 |
-
},
|
| 206 |
{
|
| 207 |
"name": "stdout",
|
| 208 |
"output_type": "stream",
|
|
@@ -216,74 +209,89 @@
|
|
| 216 |
"data": {
|
| 217 |
"text/plain": []
|
| 218 |
},
|
| 219 |
-
"execution_count":
|
| 220 |
"metadata": {},
|
| 221 |
"output_type": "execute_result"
|
| 222 |
},
|
| 223 |
{
|
| 224 |
-
"
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
"
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
"
|
| 253 |
-
"
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
"
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
}
|
| 282 |
],
|
| 283 |
"source": [
|
| 284 |
"#|export\n",
|
| 285 |
-
"image = gr.
|
| 286 |
-
"label = gr.
|
| 287 |
"examples = ['dog.jpeg', 'cat.jpeg', 'wot.jpeg']\n",
|
| 288 |
"\n",
|
| 289 |
"\n",
|
|
|
|
| 9 |
},
|
| 10 |
{
|
| 11 |
"cell_type": "code",
|
| 12 |
+
"execution_count": 5,
|
| 13 |
"metadata": {},
|
| 14 |
"outputs": [],
|
| 15 |
"source": [
|
|
|
|
| 24 |
},
|
| 25 |
{
|
| 26 |
"cell_type": "code",
|
| 27 |
+
"execution_count": 6,
|
| 28 |
"metadata": {},
|
| 29 |
"outputs": [
|
| 30 |
{
|
|
|
|
| 35 |
"PILImage mode=RGB size=192x108"
|
| 36 |
]
|
| 37 |
},
|
| 38 |
+
"execution_count": 6,
|
| 39 |
"metadata": {},
|
| 40 |
"output_type": "execute_result"
|
| 41 |
}
|
|
|
|
| 48 |
},
|
| 49 |
{
|
| 50 |
"cell_type": "code",
|
| 51 |
+
"execution_count": 7,
|
| 52 |
"metadata": {},
|
| 53 |
"outputs": [],
|
| 54 |
"source": [
|
|
|
|
| 58 |
},
|
| 59 |
{
|
| 60 |
"cell_type": "code",
|
| 61 |
+
"execution_count": 8,
|
| 62 |
"metadata": {},
|
| 63 |
"outputs": [
|
| 64 |
{
|
|
|
|
| 104 |
"('False', tensor(0), tensor([1.0000e+00, 9.8498e-07]))"
|
| 105 |
]
|
| 106 |
},
|
| 107 |
+
"execution_count": 8,
|
| 108 |
"metadata": {},
|
| 109 |
"output_type": "execute_result"
|
| 110 |
}
|
|
|
|
| 115 |
},
|
| 116 |
{
|
| 117 |
"cell_type": "code",
|
| 118 |
+
"execution_count": 9,
|
| 119 |
"metadata": {},
|
| 120 |
"outputs": [],
|
| 121 |
"source": [
|
|
|
|
| 129 |
},
|
| 130 |
{
|
| 131 |
"cell_type": "code",
|
| 132 |
+
"execution_count": 10,
|
| 133 |
"metadata": {},
|
| 134 |
"outputs": [
|
| 135 |
{
|
|
|
|
| 161 |
},
|
| 162 |
{
|
| 163 |
"data": {
|
| 164 |
+
"text/html": [
|
| 165 |
+
"\n",
|
| 166 |
+
" <div>\n",
|
| 167 |
+
" <progress value='0' class='' max='1' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
|
| 168 |
+
" 0.00% [0/1 00:00<?]\n",
|
| 169 |
+
" </div>\n",
|
| 170 |
+
" "
|
| 171 |
+
],
|
| 172 |
"text/plain": [
|
| 173 |
"<IPython.core.display.HTML object>"
|
| 174 |
]
|
|
|
|
| 182 |
"{'Dog': 0.9999990463256836, 'Cat': 9.849827620200813e-07}"
|
| 183 |
]
|
| 184 |
},
|
| 185 |
+
"execution_count": 10,
|
| 186 |
"metadata": {},
|
| 187 |
"output_type": "execute_result"
|
| 188 |
}
|
|
|
|
| 193 |
},
|
| 194 |
{
|
| 195 |
"cell_type": "code",
|
| 196 |
+
"execution_count": null,
|
| 197 |
"metadata": {},
|
| 198 |
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
{
|
| 200 |
"name": "stdout",
|
| 201 |
"output_type": "stream",
|
|
|
|
| 209 |
"data": {
|
| 210 |
"text/plain": []
|
| 211 |
},
|
| 212 |
+
"execution_count": 11,
|
| 213 |
"metadata": {},
|
| 214 |
"output_type": "execute_result"
|
| 215 |
},
|
| 216 |
{
|
| 217 |
+
"data": {
|
| 218 |
+
"text/html": [
|
| 219 |
+
"\n",
|
| 220 |
+
"<style>\n",
|
| 221 |
+
" /* Turns off some styling */\n",
|
| 222 |
+
" progress {\n",
|
| 223 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
| 224 |
+
" border: none;\n",
|
| 225 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
| 226 |
+
" background-size: auto;\n",
|
| 227 |
+
" }\n",
|
| 228 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
| 229 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
| 230 |
+
" }\n",
|
| 231 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
| 232 |
+
" background: #F44336;\n",
|
| 233 |
+
" }\n",
|
| 234 |
+
"</style>\n"
|
| 235 |
+
],
|
| 236 |
+
"text/plain": [
|
| 237 |
+
"<IPython.core.display.HTML object>"
|
| 238 |
+
]
|
| 239 |
+
},
|
| 240 |
+
"metadata": {},
|
| 241 |
+
"output_type": "display_data"
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
"data": {
|
| 245 |
+
"text/html": [],
|
| 246 |
+
"text/plain": [
|
| 247 |
+
"<IPython.core.display.HTML object>"
|
| 248 |
+
]
|
| 249 |
+
},
|
| 250 |
+
"metadata": {},
|
| 251 |
+
"output_type": "display_data"
|
| 252 |
+
},
|
| 253 |
+
{
|
| 254 |
+
"data": {
|
| 255 |
+
"text/html": [
|
| 256 |
+
"\n",
|
| 257 |
+
"<style>\n",
|
| 258 |
+
" /* Turns off some styling */\n",
|
| 259 |
+
" progress {\n",
|
| 260 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
| 261 |
+
" border: none;\n",
|
| 262 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
| 263 |
+
" background-size: auto;\n",
|
| 264 |
+
" }\n",
|
| 265 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
| 266 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
| 267 |
+
" }\n",
|
| 268 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
| 269 |
+
" background: #F44336;\n",
|
| 270 |
+
" }\n",
|
| 271 |
+
"</style>\n"
|
| 272 |
+
],
|
| 273 |
+
"text/plain": [
|
| 274 |
+
"<IPython.core.display.HTML object>"
|
| 275 |
+
]
|
| 276 |
+
},
|
| 277 |
+
"metadata": {},
|
| 278 |
+
"output_type": "display_data"
|
| 279 |
+
},
|
| 280 |
+
{
|
| 281 |
+
"data": {
|
| 282 |
+
"text/html": [],
|
| 283 |
+
"text/plain": [
|
| 284 |
+
"<IPython.core.display.HTML object>"
|
| 285 |
+
]
|
| 286 |
+
},
|
| 287 |
+
"metadata": {},
|
| 288 |
+
"output_type": "display_data"
|
| 289 |
}
|
| 290 |
],
|
| 291 |
"source": [
|
| 292 |
"#|export\n",
|
| 293 |
+
"image = gr.Image(shape=(192, 192))\n",
|
| 294 |
+
"label = gr.Label()\n",
|
| 295 |
"examples = ['dog.jpeg', 'cat.jpeg', 'wot.jpeg']\n",
|
| 296 |
"\n",
|
| 297 |
"\n",
|