Spaces:
Runtime error
Runtime error
File size: 23,437 Bytes
34989ce |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 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 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"#|default_exp app"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting gradio\n",
" Downloading gradio-3.2-py3-none-any.whl (6.1 MB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m6.1/6.1 MB\u001b[0m \u001b[31m16.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n",
"\u001b[?25hCollecting pycryptodome\n",
" Downloading pycryptodome-3.15.0.tar.gz (4.5 MB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m4.5/4.5 MB\u001b[0m \u001b[31m28.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n",
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25ldone\n",
"\u001b[?25hCollecting ffmpy\n",
" Downloading ffmpy-0.3.0.tar.gz (4.8 kB)\n",
" Preparing metadata (setup.py) ... \u001b[?25ldone\n",
"\u001b[?25hCollecting pydub\n",
" Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n",
"Collecting orjson\n",
" Downloading orjson-3.8.0-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (483 kB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m483.2/483.2 kB\u001b[0m \u001b[31m17.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: pillow in /Users/rudra/mambaforge/lib/python3.10/site-packages (from gradio) (9.2.0)\n",
"Collecting fastapi\n",
" Downloading fastapi-0.82.0-py3-none-any.whl (55 kB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m55.3/55.3 kB\u001b[0m \u001b[31m2.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: Jinja2 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from gradio) (3.1.2)\n",
"Collecting analytics-python\n",
" Downloading analytics_python-1.4.0-py2.py3-none-any.whl (15 kB)\n",
"Collecting websockets\n",
" Downloading websockets-10.3-cp310-cp310-macosx_11_0_arm64.whl (97 kB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m97.3/97.3 kB\u001b[0m \u001b[31m4.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: matplotlib in /Users/rudra/mambaforge/lib/python3.10/site-packages (from gradio) (3.5.3)\n",
"Collecting aiohttp\n",
" Downloading aiohttp-3.8.1-cp310-cp310-macosx_11_0_arm64.whl (552 kB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m552.5/552.5 kB\u001b[0m \u001b[31m15.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: numpy in /Users/rudra/mambaforge/lib/python3.10/site-packages (from gradio) (1.23.2)\n",
"Requirement already satisfied: requests in /Users/rudra/mambaforge/lib/python3.10/site-packages (from gradio) (2.28.1)\n",
"Collecting markdown-it-py[linkify,plugins]\n",
" Downloading markdown_it_py-2.1.0-py3-none-any.whl (84 kB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m84.5/84.5 kB\u001b[0m \u001b[31m3.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting fsspec\n",
" Downloading fsspec-2022.8.2-py3-none-any.whl (140 kB)\n",
"\u001b[2K \u001b[90mβββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m140.8/140.8 kB\u001b[0m \u001b[31m5.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: pydantic in /Users/rudra/mambaforge/lib/python3.10/site-packages (from gradio) (1.9.2)\n",
"Collecting paramiko\n",
" Downloading paramiko-2.11.0-py2.py3-none-any.whl (212 kB)\n",
"\u001b[2K \u001b[90mβββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m212.9/212.9 kB\u001b[0m \u001b[31m2.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
"\u001b[?25hCollecting python-multipart\n",
" Downloading python-multipart-0.0.5.tar.gz (32 kB)\n",
" Preparing metadata (setup.py) ... \u001b[?25ldone\n",
"\u001b[?25hCollecting h11<0.13,>=0.11\n",
" Downloading h11-0.12.0-py3-none-any.whl (54 kB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m54.9/54.9 kB\u001b[0m \u001b[31m2.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting httpx\n",
" Downloading httpx-0.23.0-py3-none-any.whl (84 kB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m84.8/84.8 kB\u001b[0m \u001b[31m3.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: pandas in /Users/rudra/mambaforge/lib/python3.10/site-packages (from gradio) (1.4.4)\n",
"Collecting uvicorn\n",
" Downloading uvicorn-0.18.3-py3-none-any.whl (57 kB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m57.4/57.4 kB\u001b[0m \u001b[31m1.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting multidict<7.0,>=4.5\n",
" Downloading multidict-6.0.2-cp310-cp310-macosx_11_0_arm64.whl (29 kB)\n",
"Collecting aiosignal>=1.1.2\n",
" Downloading aiosignal-1.2.0-py3-none-any.whl (8.2 kB)\n",
"Collecting yarl<2.0,>=1.0\n",
" Downloading yarl-1.8.1-cp310-cp310-macosx_11_0_arm64.whl (57 kB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m57.7/57.7 kB\u001b[0m \u001b[31m2.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting frozenlist>=1.1.1\n",
" Downloading frozenlist-1.3.1-cp310-cp310-macosx_11_0_arm64.whl (34 kB)\n",
"Requirement already satisfied: attrs>=17.3.0 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from aiohttp->gradio) (22.1.0)\n",
"Collecting async-timeout<5.0,>=4.0.0a3\n",
" Downloading async_timeout-4.0.2-py3-none-any.whl (5.8 kB)\n",
"Requirement already satisfied: charset-normalizer<3.0,>=2.0 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from aiohttp->gradio) (2.1.1)\n",
"Requirement already satisfied: python-dateutil>2.1 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from analytics-python->gradio) (2.8.2)\n",
"Requirement already satisfied: six>=1.5 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from analytics-python->gradio) (1.16.0)\n",
"Collecting backoff==1.10.0\n",
" Downloading backoff-1.10.0-py2.py3-none-any.whl (31 kB)\n",
"Collecting monotonic>=1.5\n",
" Downloading monotonic-1.6-py2.py3-none-any.whl (8.2 kB)\n",
"Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from requests->gradio) (1.26.11)\n",
"Requirement already satisfied: idna<4,>=2.5 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from requests->gradio) (3.3)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from requests->gradio) (2022.6.15)\n",
"Collecting starlette==0.19.1\n",
" Downloading starlette-0.19.1-py3-none-any.whl (63 kB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m63.3/63.3 kB\u001b[0m \u001b[31m2.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting anyio<5,>=3.4.0\n",
" Downloading anyio-3.6.1-py3-none-any.whl (80 kB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m80.6/80.6 kB\u001b[0m \u001b[31m3.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: typing-extensions>=3.7.4.3 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from pydantic->gradio) (4.3.0)\n",
"Collecting sniffio\n",
" Downloading sniffio-1.3.0-py3-none-any.whl (10 kB)\n",
"Collecting httpcore<0.16.0,>=0.15.0\n",
" Downloading httpcore-0.15.0-py3-none-any.whl (68 kB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m68.4/68.4 kB\u001b[0m \u001b[31m2.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting rfc3986[idna2008]<2,>=1.3\n",
" Downloading rfc3986-1.5.0-py2.py3-none-any.whl (31 kB)\n",
"Requirement already satisfied: MarkupSafe>=2.0 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from Jinja2->gradio) (2.1.1)\n",
"Collecting mdurl~=0.1\n",
" Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)\n",
"Collecting mdit-py-plugins\n",
" Downloading mdit_py_plugins-0.3.0-py3-none-any.whl (43 kB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m43.7/43.7 kB\u001b[0m \u001b[31m1.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hCollecting linkify-it-py~=1.0\n",
" Downloading linkify_it_py-1.0.3-py3-none-any.whl (19 kB)\n",
"Requirement already satisfied: packaging>=20.0 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from matplotlib->gradio) (21.3)\n",
"Requirement already satisfied: cycler>=0.10 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from matplotlib->gradio) (0.11.0)\n",
"Requirement already satisfied: pyparsing>=2.2.1 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from matplotlib->gradio) (3.0.9)\n",
"Requirement already satisfied: fonttools>=4.22.0 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from matplotlib->gradio) (4.37.1)\n",
"Requirement already satisfied: kiwisolver>=1.0.1 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from matplotlib->gradio) (1.4.4)\n",
"Requirement already satisfied: pytz>=2020.1 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from pandas->gradio) (2022.2.1)\n",
"Collecting pynacl>=1.0.1\n",
" Downloading PyNaCl-1.5.0-cp36-abi3-macosx_10_10_universal2.whl (349 kB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m349.9/349.9 kB\u001b[0m \u001b[31m13.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: cryptography>=2.5 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from paramiko->gradio) (37.0.4)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting bcrypt>=3.1.3\n",
" Downloading bcrypt-4.0.0-cp36-abi3-macosx_10_10_universal2.whl (475 kB)\n",
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m475.0/475.0 kB\u001b[0m \u001b[31m16.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: click>=7.0 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from uvicorn->gradio) (8.1.3)\n",
"Requirement already satisfied: cffi>=1.12 in /Users/rudra/mambaforge/lib/python3.10/site-packages (from cryptography>=2.5->paramiko->gradio) (1.15.1)\n",
"Collecting uc-micro-py\n",
" Downloading uc_micro_py-1.0.1-py3-none-any.whl (6.2 kB)\n",
"Requirement already satisfied: pycparser in /Users/rudra/mambaforge/lib/python3.10/site-packages (from cffi>=1.12->cryptography>=2.5->paramiko->gradio) (2.21)\n",
"Building wheels for collected packages: ffmpy, pycryptodome, python-multipart\n",
" Building wheel for ffmpy (setup.py) ... \u001b[?25ldone\n",
"\u001b[?25h Created wheel for ffmpy: filename=ffmpy-0.3.0-py3-none-any.whl size=4693 sha256=cca6ffaeb95611efa462dd6db688783feed1689cfaf3dc0f4fdadff6b795d6f1\n",
" Stored in directory: /Users/rudra/Library/Caches/pip/wheels/0c/c2/0e/3b9c6845c6a4e35beb90910cc70d9ac9ab5d47402bd62af0df\n",
" Building wheel for pycryptodome (setup.py) ... \u001b[?25ldone\n",
"\u001b[?25h Created wheel for pycryptodome: filename=pycryptodome-3.15.0-cp35-abi3-macosx_11_0_arm64.whl size=1531792 sha256=4d20b21a578e519808e9790f3165eaa567e7948a7efb8ad2a95167b503b66c97\n",
" Stored in directory: /Users/rudra/Library/Caches/pip/wheels/cc/09/af/5da58a51ca5bf4bd4a37747a0658984c196aa2badf61236a35\n",
" Building wheel for python-multipart (setup.py) ... \u001b[?25ldone\n",
"\u001b[?25h Created wheel for python-multipart: filename=python_multipart-0.0.5-py3-none-any.whl size=31671 sha256=74cbcfb82ca96c926b3312fdff0ee48229ecef1fc306cf1b79eca31112851db6\n",
" Stored in directory: /Users/rudra/Library/Caches/pip/wheels/ae/3f/03/fa4bd98cd7f4a25e63b6a0b61a7a8352e0f874cd9de1f3390d\n",
"Successfully built ffmpy pycryptodome python-multipart\n",
"Installing collected packages: rfc3986, pydub, monotonic, ffmpy, websockets, uc-micro-py, sniffio, python-multipart, pycryptodome, orjson, multidict, mdurl, h11, fsspec, frozenlist, bcrypt, backoff, async-timeout, yarl, uvicorn, pynacl, markdown-it-py, linkify-it-py, anyio, analytics-python, aiosignal, starlette, paramiko, mdit-py-plugins, httpcore, aiohttp, httpx, fastapi, gradio\n",
"Successfully installed aiohttp-3.8.1 aiosignal-1.2.0 analytics-python-1.4.0 anyio-3.6.1 async-timeout-4.0.2 backoff-1.10.0 bcrypt-4.0.0 fastapi-0.82.0 ffmpy-0.3.0 frozenlist-1.3.1 fsspec-2022.8.2 gradio-3.2 h11-0.12.0 httpcore-0.15.0 httpx-0.23.0 linkify-it-py-1.0.3 markdown-it-py-2.1.0 mdit-py-plugins-0.3.0 mdurl-0.1.2 monotonic-1.6 multidict-6.0.2 orjson-3.8.0 paramiko-2.11.0 pycryptodome-3.15.0 pydub-0.25.1 pynacl-1.5.0 python-multipart-0.0.5 rfc3986-1.5.0 sniffio-1.3.0 starlette-0.19.1 uc-micro-py-1.0.1 uvicorn-0.18.3 websockets-10.3 yarl-1.8.1\n"
]
}
],
"source": [
"#!pip install gradio"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Lamborghini vs Mercedes"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/rudra/mambaforge/lib/python3.10/site-packages/tqdm/auto.py:22: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
}
],
"source": [
"#|export\n",
"\n",
"from fastai.vision.all import *\n",
"import gradio as gr"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"#|export\n",
"learn = load_learner('lamborghini_vs_mercedes_model.pkl')"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"#|export\n",
"categories = ('lamborghini', 'mercedes')\n",
"\n",
"def predict(img):\n",
" pred, idx, prob = learn.predict(img)\n",
" return dict(zip(categories, map(float, prob)))"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<style>\n",
" /* Turns off some styling */\n",
" progress {\n",
" /* gets rid of default border in Firefox and Opera. */\n",
" border: none;\n",
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
" background-size: auto;\n",
" }\n",
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
" }\n",
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
" background: #F44336;\n",
" }\n",
"</style>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"{'lamborghini': 1.0, 'mercedes': 6.128332508126277e-09}"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"img = PILImage.create('lambo1.jpg')\n",
"predict(img)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/rudra/mambaforge/lib/python3.10/site-packages/gradio/inputs.py:256: UserWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n",
" warnings.warn(\n",
"/Users/rudra/mambaforge/lib/python3.10/site-packages/gradio/deprecation.py:40: UserWarning: `optional` parameter is deprecated, and it has no effect\n",
" warnings.warn(value)\n",
"/Users/rudra/mambaforge/lib/python3.10/site-packages/gradio/outputs.py:196: UserWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\n",
" warnings.warn(\n",
"/Users/rudra/mambaforge/lib/python3.10/site-packages/gradio/deprecation.py:40: UserWarning: The 'type' parameter has been deprecated. Use the Number component instead.\n",
" warnings.warn(value)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Running on local URL: http://127.0.0.1:7861/\n",
"\n",
"To create a public link, set `share=True` in `launch()`.\n"
]
},
{
"data": {
"text/plain": [
"(<gradio.routes.App at 0x154cb0cd0>, 'http://127.0.0.1:7861/', None)"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"text/html": [
"\n",
"<style>\n",
" /* Turns off some styling */\n",
" progress {\n",
" /* gets rid of default border in Firefox and Opera. */\n",
" border: none;\n",
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
" background-size: auto;\n",
" }\n",
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
" }\n",
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
" background: #F44336;\n",
" }\n",
"</style>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
"<style>\n",
" /* Turns off some styling */\n",
" progress {\n",
" /* gets rid of default border in Firefox and Opera. */\n",
" border: none;\n",
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
" background-size: auto;\n",
" }\n",
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
" }\n",
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
" background: #F44336;\n",
" }\n",
"</style>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#|export\n",
"image = gr.inputs.Image(shape=(192,192))\n",
"label = gr.outputs.Label()\n",
"\n",
"interface = gr.Interface(fn=predict, inputs=image, outputs=label, examples=['lambo1.jpg', 'mercedes1.jpg'])\n",
"interface.launch(inline=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Export"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"from nbdev.export import nb_export\n",
"nb_export('app.ipynb', '.')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"interpreter": {
"hash": "a03200ae361ba04b33dfbb7697ae27a1e19c2e9be6094bfaf79232177e8f3033"
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
|