Spaces:
Sleeping
Sleeping
File size: 24,947 Bytes
66aad4a |
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 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 13,
"id": "7fc1cfd9-803d-4f61-a21c-59033a36278e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"^C\n"
]
}
],
"source": [
"!pip install --timeout=1000 fastai gradio"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "58c07559-6cbd-48d5-9557-aa84e905f924",
"metadata": {},
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'fastai'",
"output_type": "error",
"traceback": [
"\u001b[1;31m--------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[12], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m#|export\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mfastai\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mvision\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mall\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n\u001b[0;32m 3\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mgradio\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mgr\u001b[39;00m\n\u001b[0;32m 5\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mis_cat\u001b[39m(x): \u001b[38;5;28;01mreturn\u001b[39;00m x[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m.\u001b[39misupper()\n",
"\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'fastai'"
]
}
],
"source": [
"#|export\n",
"from fastai.vision.all import *\n",
"import gradio as gr\n",
"\n",
"def is_cat(x): return x[0].isupper()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ce124f30-6301-4958-be14-a5592a4c4e49",
"metadata": {},
"outputs": [],
"source": [
"im = PILImage.create('dog.jpg')\n",
"im.thumbnail(192, 192))\n",
"im"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3b9065f9-ac03-4876-b99f-d556c2b6efb6",
"metadata": {},
"outputs": [],
"source": [
"#|export\n",
"learn = load_learn('model.pkl')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "28b729e9-ddfd-469e-8998-50290889417d",
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"ERROR: Exception:\n",
"Traceback (most recent call last):\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 438, in _error_catcher\n",
" yield\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 561, in read\n",
" data = self._fp_read(amt) if not fp_closed else b\"\"\n",
" ^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 527, in _fp_read\n",
" return self._fp.read(amt) if amt is not None else self._fp.read()\n",
" ^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\cachecontrol\\filewrapper.py\", line 90, in read\n",
" data = self.__fp.read(amt)\n",
" ^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\http\\client.py\", line 466, in read\n",
" s = self.fp.read(amt)\n",
" ^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\socket.py\", line 706, in readinto\n",
" return self._sock.recv_into(b)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\ssl.py\", line 1278, in recv_into\n",
" return self.read(nbytes, buffer)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\ssl.py\", line 1134, in read\n",
" return self._sslobj.read(len, buffer)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
"TimeoutError: The read operation timed out\n",
"\n",
"During handling of the above exception, another exception occurred:\n",
"\n",
"Traceback (most recent call last):\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\cli\\base_command.py\", line 180, in exc_logging_wrapper\n",
" status = run_func(*args)\n",
" ^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\cli\\req_command.py\", line 248, in wrapper\n",
" return func(self, options, args)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\commands\\install.py\", line 377, in run\n",
" requirement_set = resolver.resolve(\n",
" ^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\resolver.py\", line 92, in resolve\n",
" result = self._result = resolver.resolve(\n",
" ^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\resolvelib\\resolvers.py\", line 546, in resolve\n",
" state = resolution.resolve(requirements, max_rounds=max_rounds)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\resolvelib\\resolvers.py\", line 427, in resolve\n",
" failure_causes = self._attempt_to_pin_criterion(name)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\resolvelib\\resolvers.py\", line 239, in _attempt_to_pin_criterion\n",
" criteria = self._get_updated_criteria(candidate)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\resolvelib\\resolvers.py\", line 230, in _get_updated_criteria\n",
" self._add_to_criteria(criteria, requirement, parent=candidate)\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\resolvelib\\resolvers.py\", line 173, in _add_to_criteria\n",
" if not criterion.candidates:\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\resolvelib\\structs.py\", line 156, in __bool__\n",
" return bool(self._sequence)\n",
" ^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\found_candidates.py\", line 155, in __bool__\n",
" return any(self)\n",
" ^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\found_candidates.py\", line 143, in <genexpr>\n",
" return (c for c in iterator if id(c) not in self._incompatible_ids)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\found_candidates.py\", line 47, in _iter_built\n",
" candidate = func()\n",
" ^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\factory.py\", line 206, in _make_candidate_from_link\n",
" self._link_candidate_cache[link] = LinkCandidate(\n",
" ^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\candidates.py\", line 293, in __init__\n",
" super().__init__(\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\candidates.py\", line 156, in __init__\n",
" self.dist = self._prepare()\n",
" ^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\candidates.py\", line 225, in _prepare\n",
" dist = self._prepare_distribution()\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\candidates.py\", line 304, in _prepare_distribution\n",
" return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\operations\\prepare.py\", line 538, in prepare_linked_requirement\n",
" return self._prepare_linked_requirement(req, parallel_builds)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\operations\\prepare.py\", line 609, in _prepare_linked_requirement\n",
" local_file = unpack_url(\n",
" ^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\operations\\prepare.py\", line 166, in unpack_url\n",
" file = get_http_url(\n",
" ^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\operations\\prepare.py\", line 107, in get_http_url\n",
" from_path, content_type = download(link, temp_dir.path)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\network\\download.py\", line 147, in __call__\n",
" for chunk in chunks:\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\network\\utils.py\", line 63, in response_chunks\n",
" for chunk in response.raw.stream(\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 622, in stream\n",
" data = self.read(amt=amt, decode_content=decode_content)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 560, in read\n",
" with self._error_catcher():\n",
" File \"C:\\Python311\\Lib\\contextlib.py\", line 155, in __exit__\n",
" self.gen.throw(typ, value, traceback)\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 443, in _error_catcher\n",
" raise ReadTimeoutError(self._pool, None, \"Read timed out.\")\n",
"pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.\n",
"ERROR: Exception:\n",
"Traceback (most recent call last):\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 438, in _error_catcher\n",
" yield\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 561, in read\n",
" data = self._fp_read(amt) if not fp_closed else b\"\"\n",
" ^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 527, in _fp_read\n",
" return self._fp.read(amt) if amt is not None else self._fp.read()\n",
" ^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\cachecontrol\\filewrapper.py\", line 90, in read\n",
" data = self.__fp.read(amt)\n",
" ^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\http\\client.py\", line 466, in read\n",
" s = self.fp.read(amt)\n",
" ^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\socket.py\", line 706, in readinto\n",
" return self._sock.recv_into(b)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\ssl.py\", line 1278, in recv_into\n",
" return self.read(nbytes, buffer)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\ssl.py\", line 1134, in read\n",
" return self._sslobj.read(len, buffer)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
"TimeoutError: The read operation timed out\n",
"\n",
"During handling of the above exception, another exception occurred:\n",
"\n",
"Traceback (most recent call last):\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\cli\\base_command.py\", line 180, in exc_logging_wrapper\n",
" status = run_func(*args)\n",
" ^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\cli\\req_command.py\", line 248, in wrapper\n",
" return func(self, options, args)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\commands\\install.py\", line 377, in run\n",
" requirement_set = resolver.resolve(\n",
" ^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\resolver.py\", line 92, in resolve\n",
" result = self._result = resolver.resolve(\n",
" ^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\resolvelib\\resolvers.py\", line 546, in resolve\n",
" state = resolution.resolve(requirements, max_rounds=max_rounds)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\resolvelib\\resolvers.py\", line 427, in resolve\n",
" failure_causes = self._attempt_to_pin_criterion(name)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\resolvelib\\resolvers.py\", line 237, in _attempt_to_pin_criterion\n",
" for candidate in criterion.candidates:\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\found_candidates.py\", line 143, in <genexpr>\n",
" return (c for c in iterator if id(c) not in self._incompatible_ids)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\found_candidates.py\", line 47, in _iter_built\n",
" candidate = func()\n",
" ^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\factory.py\", line 206, in _make_candidate_from_link\n",
" self._link_candidate_cache[link] = LinkCandidate(\n",
" ^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\candidates.py\", line 293, in __init__\n",
" super().__init__(\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\candidates.py\", line 156, in __init__\n",
" self.dist = self._prepare()\n",
" ^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\candidates.py\", line 225, in _prepare\n",
" dist = self._prepare_distribution()\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\resolution\\resolvelib\\candidates.py\", line 304, in _prepare_distribution\n",
" return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\operations\\prepare.py\", line 538, in prepare_linked_requirement\n",
" return self._prepare_linked_requirement(req, parallel_builds)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\operations\\prepare.py\", line 609, in _prepare_linked_requirement\n",
" local_file = unpack_url(\n",
" ^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\operations\\prepare.py\", line 166, in unpack_url\n",
" file = get_http_url(\n",
" ^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\operations\\prepare.py\", line 107, in get_http_url\n",
" from_path, content_type = download(link, temp_dir.path)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\network\\download.py\", line 147, in __call__\n",
" for chunk in chunks:\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_internal\\network\\utils.py\", line 63, in response_chunks\n",
" for chunk in response.raw.stream(\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 622, in stream\n",
" data = self.read(amt=amt, decode_content=decode_content)\n",
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 560, in read\n",
" with self._error_catcher():\n",
" File \"C:\\Python311\\Lib\\contextlib.py\", line 155, in __exit__\n",
" self.gen.throw(typ, value, traceback)\n",
" File \"C:\\Python311\\Lib\\site-packages\\pip\\_vendor\\urllib3\\response.py\", line 443, in _error_catcher\n",
" raise ReadTimeoutError(self._pool, None, \"Read timed out.\")\n",
"pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.\n"
]
}
],
"source": [
"%time learn.predict(im)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5c3c9a01-fcb7-46c7-9fef-b03bb95c48d2",
"metadata": {},
"outputs": [],
"source": [
"#|export\n",
"categories = ('Dog', 'Cat')\n",
"\n",
"def classify_image(img):\n",
" pred, idx, probs = learn.predict(img)\n",
" return dict(zip(categories, map(float, probs))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "55dd515e-3648-432c-9d71-e3322fcff7de",
"metadata": {},
"outputs": [],
"source": [
"classify_image(im)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "23aa42c6-24ce-4b3a-a0c1-24a35f67251e",
"metadata": {},
"outputs": [],
"source": [
"#|export\n",
"image = gr.inputs.Image(shape=(192, 192))\n",
"label = gr.outputs.Label()\n",
"examples = ['dog.jpg', 'cat.jpg']\n",
"\n",
"intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)\n",
"intf.launch(inline=False)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "3959f648-7188-48cc-ab2a-bf8157c3b80b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: nbdev in c:\\users\\user\\appdata\\roaming\\python\\python311\\site-packages (2.3.12)\n",
"Requirement already satisfied: fastcore>=1.5.27 in c:\\users\\user\\appdata\\roaming\\python\\python311\\site-packages (from nbdev) (1.5.29)\n",
"Requirement already satisfied: execnb>=0.1.4 in c:\\users\\user\\appdata\\roaming\\python\\python311\\site-packages (from nbdev) (0.1.5)\n",
"Requirement already satisfied: astunparse in c:\\users\\user\\appdata\\roaming\\python\\python311\\site-packages (from nbdev) (1.6.3)\n",
"Requirement already satisfied: ghapi>=1.0.3 in c:\\users\\user\\appdata\\roaming\\python\\python311\\site-packages (from nbdev) (1.0.4)\n",
"Requirement already satisfied: watchdog in c:\\users\\user\\appdata\\roaming\\python\\python311\\site-packages (from nbdev) (3.0.0)\n",
"Requirement already satisfied: asttokens in c:\\python311\\lib\\site-packages (from nbdev) (2.2.1)\n",
"Requirement already satisfied: PyYAML in c:\\python311\\lib\\site-packages (from nbdev) (6.0.1)\n",
"Requirement already satisfied: ipython in c:\\python311\\lib\\site-packages (from execnb>=0.1.4->nbdev) (8.14.0)\n",
"Requirement already satisfied: pip in c:\\python311\\lib\\site-packages (from fastcore>=1.5.27->nbdev) (23.2.1)\n",
"Requirement already satisfied: packaging in c:\\python311\\lib\\site-packages (from fastcore>=1.5.27->nbdev) (23.1)\n",
"Requirement already satisfied: six in c:\\python311\\lib\\site-packages (from asttokens->nbdev) (1.16.0)\n",
"Requirement already satisfied: wheel<1.0,>=0.23.0 in c:\\python311\\lib\\site-packages (from astunparse->nbdev) (0.41.2)\n",
"Requirement already satisfied: backcall in c:\\python311\\lib\\site-packages (from ipython->execnb>=0.1.4->nbdev) (0.2.0)\n",
"Requirement already satisfied: decorator in c:\\python311\\lib\\site-packages (from ipython->execnb>=0.1.4->nbdev) (5.1.1)\n",
"Requirement already satisfied: jedi>=0.16 in c:\\python311\\lib\\site-packages (from ipython->execnb>=0.1.4->nbdev) (0.19.0)\n",
"Requirement already satisfied: matplotlib-inline in c:\\python311\\lib\\site-packages (from ipython->execnb>=0.1.4->nbdev) (0.1.6)\n",
"Requirement already satisfied: pickleshare in c:\\python311\\lib\\site-packages (from ipython->execnb>=0.1.4->nbdev) (0.7.5)\n",
"Requirement already satisfied: prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30 in c:\\python311\\lib\\site-packages (from ipython->execnb>=0.1.4->nbdev) (3.0.39)\n",
"Requirement already satisfied: pygments>=2.4.0 in c:\\python311\\lib\\site-packages (from ipython->execnb>=0.1.4->nbdev) (2.16.1)\n",
"Requirement already satisfied: stack-data in c:\\python311\\lib\\site-packages (from ipython->execnb>=0.1.4->nbdev) (0.6.2)\n",
"Requirement already satisfied: traitlets>=5 in c:\\python311\\lib\\site-packages (from ipython->execnb>=0.1.4->nbdev) (5.9.0)\n",
"Requirement already satisfied: colorama in c:\\python311\\lib\\site-packages (from ipython->execnb>=0.1.4->nbdev) (0.4.6)\n",
"Requirement already satisfied: parso<0.9.0,>=0.8.3 in c:\\python311\\lib\\site-packages (from jedi>=0.16->ipython->execnb>=0.1.4->nbdev) (0.8.3)\n",
"Requirement already satisfied: wcwidth in c:\\python311\\lib\\site-packages (from prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30->ipython->execnb>=0.1.4->nbdev) (0.2.6)\n",
"Requirement already satisfied: executing>=1.2.0 in c:\\python311\\lib\\site-packages (from stack-data->ipython->execnb>=0.1.4->nbdev) (1.2.0)\n",
"Requirement already satisfied: pure-eval in c:\\python311\\lib\\site-packages (from stack-data->ipython->execnb>=0.1.4->nbdev) (0.2.2)\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"DEPRECATION: Loading egg at c:\\python311\\lib\\site-packages\\vboxapi-1.0-py3.11.egg is deprecated. pip 23.3 will enforce this behaviour change. A possible replacement is to use pip for package installation..\n"
]
}
],
"source": [
"!pip install nbdev --user"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "5fd6a6e9-60c1-44f5-99de-03dca35aef62",
"metadata": {},
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'nbdev'",
"output_type": "error",
"traceback": [
"\u001b[1;31m--------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[21], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mnbdev\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mexport\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m notebook2script\n",
"\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'nbdev'"
]
}
],
"source": [
"from nbdev.export import notebook2script"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d24d921a-f65f-45b2-aa28-fe7035107c86",
"metadata": {},
"outputs": [],
"source": [
"notebook2script('app.ipynb')"
]
}
],
"metadata": {
"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.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
|