File size: 19,233 Bytes
36de64c
 
f72940a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36de64c
 
 
 
 
 
 
 
 
 
f72940a
36de64c
f72940a
 
 
 
36de64c
 
 
f72940a
 
36de64c
 
f72940a
36de64c
 
 
 
 
f72940a
36de64c
 
 
f72940a
36de64c
 
f72940a
 
 
 
36de64c
 
 
 
f72940a
 
 
 
 
 
 
 
 
 
 
 
 
36de64c
 
 
 
f72940a
 
36de64c
f72940a
36de64c
 
f72940a
 
 
 
 
 
 
36de64c
 
 
 
f72940a
 
36de64c
 
 
f72940a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36de64c
 
 
 
f72940a
36de64c
 
 
 
f72940a
 
36de64c
 
 
f72940a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36de64c
f72940a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36de64c
 
 
 
f72940a
 
 
 
 
 
 
 
 
 
 
36de64c
 
 
 
f72940a
 
36de64c
 
 
 
 
 
f72940a
36de64c
 
 
 
 
f72940a
36de64c
 
 
 
f72940a
 
36de64c
f72940a
36de64c
f72940a
 
 
 
 
36de64c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "2904c251",
   "metadata": {},
   "outputs": [],
   "source": [
    "#|default_exp app"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8f566fe5",
   "metadata": {},
   "source": [
    "# Export instructions"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a8bd8621-65ae-4cb2-bdac-12c3b97a0de5",
   "metadata": {},
   "source": [
    "As of 24.3.18 the way to export cells to a python script is:\n",
    "1) pip install nbdev\n",
    "2) Add \"#|default_exp [file_name]\" to the top of your notebook\n",
    "3) Add \"#|export\" to the top of each cell you want to export\n",
    "4) run:\n",
    "```python\n",
    "    import nbdev\n",
    "    notebook_name = \"lesson_2.ipynb\"\n",
    "    export_destination = \".\" # the root directory\n",
    "    nbdev.export.nb_export(notebook_name, export_destination)\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6f087d39-106b-46a2-8623-f4429e2885f1",
   "metadata": {},
   "source": [
    "# Code"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "746c335b-5825-4032-9ee9-834d947ba01d",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: 'dlopen(/Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages/torchvision/image.so, 0x0006): Symbol not found: __ZN3c1017RegisterOperatorsD1Ev\n",
      "  Referenced from: <CC4BC91F-8B6A-3F9A-B9EB-A2B9D578E202> /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages/torchvision/image.so\n",
      "  Expected in:     <B36C132B-E822-3FDA-9BEC-DD9DB8197D06> /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages/torch/lib/libtorch_cpu.dylib'If you don't plan on using image functionality from `torchvision.io`, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have `libjpeg` or `libpng` installed before building `torchvision` from source?\n",
      "  warn(\n"
     ]
    }
   ],
   "source": [
    "#|export\n",
    "from fastai.vision.all import *\n",
    "from fastai.collab import *\n",
    "\n",
    "if os.path.isfile('export.pkl'):\n",
    "    learn: Learner = load_learner('export.pkl')\n",
    "else:\n",
    "    path = untar_data(URLs.PETS)\n",
    "    dls = ImageDataLoaders.from_name_re(path, get_image_files(path/'images'), pat='(.+)_\\d+.jpg', item_tfms=Resize(460), batch_tfms=aug_transforms(size=224, min_scale=0.75))\n",
    "    learn = vision_learner(dls, models.resnet50, metrics=accuracy)\n",
    "    learn.fine_tune(1)\n",
    "    learn.path = Path('.')\n",
    "    learn.export()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d670bc7e",
   "metadata": {},
   "outputs": [],
   "source": [
    "#|export\n",
    "dls: DataLoaders = learn.dls\n",
    "labels = dls.vocab\n",
    "\n",
    "def predict(image):\n",
    "    image = PILImage.create(image)\n",
    "    prediction, prediction_index, probabilities = learn.predict(image)\n",
    "    return { labels[i]: float(probabilities[i]) for i in range(len(labels))}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "5be95314",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: gradio in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (4.22.0)\n",
      "Requirement already satisfied: aiofiles<24.0,>=22.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (23.2.1)\n",
      "Requirement already satisfied: altair<6.0,>=4.2.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (5.2.0)\n",
      "Requirement already satisfied: fastapi in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (0.110.0)\n",
      "Requirement already satisfied: ffmpy in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (0.3.2)\n",
      "Requirement already satisfied: gradio-client==0.13.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (0.13.0)\n",
      "Requirement already satisfied: httpx>=0.24.1 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (0.27.0)\n",
      "Requirement already satisfied: huggingface-hub>=0.19.3 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (0.21.4)\n",
      "Requirement already satisfied: importlib-resources<7.0,>=1.3 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (6.1.1)\n",
      "Requirement already satisfied: jinja2<4.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (3.1.3)\n",
      "Requirement already satisfied: markupsafe~=2.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (2.1.3)\n",
      "Requirement already satisfied: matplotlib~=3.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (3.8.0)\n",
      "Requirement already satisfied: numpy~=1.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (1.26.4)\n",
      "Requirement already satisfied: orjson~=3.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (3.9.15)\n",
      "Requirement already satisfied: packaging in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (23.2)\n",
      "Requirement already satisfied: pandas<3.0,>=1.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (2.2.1)\n",
      "Requirement already satisfied: pillow<11.0,>=8.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (10.2.0)\n",
      "Requirement already satisfied: pydantic>=2.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (2.5.3)\n",
      "Requirement already satisfied: pydub in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (0.25.1)\n",
      "Requirement already satisfied: python-multipart>=0.0.9 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (0.0.9)\n",
      "Requirement already satisfied: pyyaml<7.0,>=5.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (6.0.1)\n",
      "Requirement already satisfied: ruff>=0.2.2 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (0.3.4)\n",
      "Requirement already satisfied: semantic-version~=2.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (2.10.0)\n",
      "Requirement already satisfied: tomlkit==0.12.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (0.12.0)\n",
      "Requirement already satisfied: typer<1.0,>=0.9 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from typer[all]<1.0,>=0.9->gradio) (0.9.0)\n",
      "Requirement already satisfied: typing-extensions~=4.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (4.9.0)\n",
      "Requirement already satisfied: uvicorn>=0.14.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio) (0.29.0)\n",
      "Requirement already satisfied: fsspec in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio-client==0.13.0->gradio) (2023.10.0)\n",
      "Requirement already satisfied: websockets<12.0,>=10.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from gradio-client==0.13.0->gradio) (11.0.3)\n",
      "Requirement already satisfied: jsonschema>=3.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from altair<6.0,>=4.2.0->gradio) (4.21.1)\n",
      "Requirement already satisfied: toolz in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from altair<6.0,>=4.2.0->gradio) (0.12.1)\n",
      "Requirement already satisfied: anyio in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from httpx>=0.24.1->gradio) (4.3.0)\n",
      "Requirement already satisfied: certifi in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from httpx>=0.24.1->gradio) (2024.2.2)\n",
      "Requirement already satisfied: httpcore==1.* in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from httpx>=0.24.1->gradio) (1.0.4)\n",
      "Requirement already satisfied: idna in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from httpx>=0.24.1->gradio) (3.4)\n",
      "Requirement already satisfied: sniffio in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from httpx>=0.24.1->gradio) (1.3.1)\n",
      "Requirement already satisfied: h11<0.15,>=0.13 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from httpcore==1.*->httpx>=0.24.1->gradio) (0.14.0)\n",
      "Requirement already satisfied: filelock in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from huggingface-hub>=0.19.3->gradio) (3.13.1)\n",
      "Requirement already satisfied: requests in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from huggingface-hub>=0.19.3->gradio) (2.31.0)\n",
      "Requirement already satisfied: tqdm>=4.42.1 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from huggingface-hub>=0.19.3->gradio) (4.65.0)\n",
      "Requirement already satisfied: zipp>=3.1.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from importlib-resources<7.0,>=1.3->gradio) (3.17.0)\n",
      "Requirement already satisfied: contourpy>=1.0.1 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from matplotlib~=3.0->gradio) (1.2.0)\n",
      "Requirement already satisfied: cycler>=0.10 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from matplotlib~=3.0->gradio) (0.11.0)\n",
      "Requirement already satisfied: fonttools>=4.22.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from matplotlib~=3.0->gradio) (4.25.0)\n",
      "Requirement already satisfied: kiwisolver>=1.0.1 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from matplotlib~=3.0->gradio) (1.4.4)\n",
      "Requirement already satisfied: pyparsing>=2.3.1 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from matplotlib~=3.0->gradio) (3.0.9)\n",
      "Requirement already satisfied: python-dateutil>=2.7 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from matplotlib~=3.0->gradio) (2.8.2)\n",
      "Requirement already satisfied: pytz>=2020.1 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from pandas<3.0,>=1.0->gradio) (2023.3.post1)\n",
      "Requirement already satisfied: tzdata>=2022.7 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from pandas<3.0,>=1.0->gradio) (2023.3)\n",
      "Requirement already satisfied: annotated-types>=0.4.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from pydantic>=2.0->gradio) (0.6.0)\n",
      "Requirement already satisfied: pydantic-core==2.14.6 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from pydantic>=2.0->gradio) (2.14.6)\n",
      "Requirement already satisfied: click<9.0.0,>=7.1.1 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from typer<1.0,>=0.9->typer[all]<1.0,>=0.9->gradio) (8.1.7)\n",
      "Requirement already satisfied: colorama<0.5.0,>=0.4.3 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from typer[all]<1.0,>=0.9->gradio) (0.4.6)\n",
      "Requirement already satisfied: shellingham<2.0.0,>=1.3.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from typer[all]<1.0,>=0.9->gradio) (1.5.0)\n",
      "Requirement already satisfied: rich<14.0.0,>=10.11.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from typer[all]<1.0,>=0.9->gradio) (13.3.5)\n",
      "Requirement already satisfied: starlette<0.37.0,>=0.36.3 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from fastapi->gradio) (0.36.3)\n",
      "Requirement already satisfied: attrs>=22.2.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (23.2.0)\n",
      "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (2023.12.1)\n",
      "Requirement already satisfied: referencing>=0.28.4 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (0.34.0)\n",
      "Requirement already satisfied: rpds-py>=0.7.1 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (0.18.0)\n",
      "Requirement already satisfied: six>=1.5 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from python-dateutil>=2.7->matplotlib~=3.0->gradio) (1.16.0)\n",
      "Requirement already satisfied: markdown-it-py<3.0.0,>=2.2.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from rich<14.0.0,>=10.11.0->typer[all]<1.0,>=0.9->gradio) (2.2.0)\n",
      "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from rich<14.0.0,>=10.11.0->typer[all]<1.0,>=0.9->gradio) (2.15.1)\n",
      "Requirement already satisfied: exceptiongroup>=1.0.2 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from anyio->httpx>=0.24.1->gradio) (1.2.0)\n",
      "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from requests->huggingface-hub>=0.19.3->gradio) (2.0.4)\n",
      "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from requests->huggingface-hub>=0.19.3->gradio) (2.1.0)\n",
      "Requirement already satisfied: mdurl~=0.1 in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (from markdown-it-py<3.0.0,>=2.2.0->rich<14.0.0,>=10.11.0->typer[all]<1.0,>=0.9->gradio) (0.1.0)\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "%pip install gradio"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "e7e4c80c",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages/tqdm/auto.py:21: 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"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Running on local URL:  http://127.0.0.1:7860\n",
      "Running on public URL: https://95de38d55a9ae84b0c.gradio.live\n",
      "\n",
      "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"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div><iframe src=\"https://95de38d55a9ae84b0c.gradio.live\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": []
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#|export\n",
    "import gradio\n",
    "interface = gradio.Interface(\n",
    "    fn=predict, \n",
    "    inputs=gradio.Image(height=512, width=512), \n",
    "    outputs=gradio.Label(num_top_classes=3),\n",
    "    title=\"Dog Breed Classifier\",\n",
    "    description=\"Upload a photo of a dog and we'll tell you the likely breeds\",\n",
    "    article=\"This is Roman, he's a Red Nosed Pitbull (aka. American Pit-Bull Terrier) from New Orleans.\\n\\nTo try out the classifier, tap on his image to load him into the input box above and then press submit.\",\n",
    "    examples=['roman.png']\n",
    ")\n",
    "interface.launch(share=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "807e0708",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: jupyterlab-quarto in /Users/charlesfeinn/miniforge-pypy3/envs/default/lib/python3.9/site-packages (0.3.3)\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "%pip install jupyterlab-quarto"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "342a044e",
   "metadata": {},
   "outputs": [],
   "source": [
    "import nbdev\n",
    "\n",
    "notebook_name = \"lesson_2.ipynb\"\n",
    "export_destination = \".\" # the root directory\n",
    "nbdev.export.nb_export(notebook_name, export_destination)"
   ]
  }
 ],
 "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.9.18"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}