Skip to content

Commit

Permalink
notebook cleaned
Browse files Browse the repository at this point in the history
  • Loading branch information
arun477 committed Sep 13, 2023
1 parent 68abbc3 commit 8edb87f
Showing 1 changed file with 4 additions and 291 deletions.
295 changes: 4 additions & 291 deletions mnist_classifier.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {
"tags": [
"exclude"
Expand All @@ -326,304 +326,17 @@
"name": "stdout",
"output_type": "stream",
"text": [
"[NbConvertApp] WARNING | pattern 'mnist.ipynb' matched no files\n",
"This application is used to convert notebook files (*.ipynb)\n",
" to various other formats.\n",
"\n",
" WARNING: THE COMMANDLINE INTERFACE MAY CHANGE IN FUTURE RELEASES.\n",
"\n",
"Options\n",
"=======\n",
"The options below are convenience aliases to configurable class-options,\n",
"as listed in the \"Equivalent to\" description-line of the aliases.\n",
"To see all configurable class-options for some <cmd>, use:\n",
" <cmd> --help-all\n",
"\n",
"--debug\n",
" set log level to logging.DEBUG (maximize logging output)\n",
" Equivalent to: [--Application.log_level=10]\n",
"--show-config\n",
" Show the application's configuration (human-readable format)\n",
" Equivalent to: [--Application.show_config=True]\n",
"--show-config-json\n",
" Show the application's configuration (json format)\n",
" Equivalent to: [--Application.show_config_json=True]\n",
"--generate-config\n",
" generate default config file\n",
" Equivalent to: [--JupyterApp.generate_config=True]\n",
"-y\n",
" Answer yes to any questions instead of prompting.\n",
" Equivalent to: [--JupyterApp.answer_yes=True]\n",
"--execute\n",
" Execute the notebook prior to export.\n",
" Equivalent to: [--ExecutePreprocessor.enabled=True]\n",
"--allow-errors\n",
" Continue notebook execution even if one of the cells throws an error and include the error message in the cell output (the default behaviour is to abort conversion). This flag is only relevant if '--execute' was specified, too.\n",
" Equivalent to: [--ExecutePreprocessor.allow_errors=True]\n",
"--stdin\n",
" read a single notebook file from stdin. Write the resulting notebook with default basename 'notebook.*'\n",
" Equivalent to: [--NbConvertApp.from_stdin=True]\n",
"--stdout\n",
" Write notebook output to stdout instead of files.\n",
" Equivalent to: [--NbConvertApp.writer_class=StdoutWriter]\n",
"--inplace\n",
" Run nbconvert in place, overwriting the existing notebook (only\n",
" relevant when converting to notebook format)\n",
" Equivalent to: [--NbConvertApp.use_output_suffix=False --NbConvertApp.export_format=notebook --FilesWriter.build_directory=]\n",
"--clear-output\n",
" Clear output of current file and save in place,\n",
" overwriting the existing notebook.\n",
" Equivalent to: [--NbConvertApp.use_output_suffix=False --NbConvertApp.export_format=notebook --FilesWriter.build_directory= --ClearOutputPreprocessor.enabled=True]\n",
"--no-prompt\n",
" Exclude input and output prompts from converted document.\n",
" Equivalent to: [--TemplateExporter.exclude_input_prompt=True --TemplateExporter.exclude_output_prompt=True]\n",
"--no-input\n",
" Exclude input cells and output prompts from converted document.\n",
" This mode is ideal for generating code-free reports.\n",
" Equivalent to: [--TemplateExporter.exclude_output_prompt=True --TemplateExporter.exclude_input=True --TemplateExporter.exclude_input_prompt=True]\n",
"--allow-chromium-download\n",
" Whether to allow downloading chromium if no suitable version is found on the system.\n",
" Equivalent to: [--WebPDFExporter.allow_chromium_download=True]\n",
"--disable-chromium-sandbox\n",
" Disable chromium security sandbox when converting to PDF..\n",
" Equivalent to: [--WebPDFExporter.disable_sandbox=True]\n",
"--show-input\n",
" Shows code input. This flag is only useful for dejavu users.\n",
" Equivalent to: [--TemplateExporter.exclude_input=False]\n",
"--embed-images\n",
" Embed the images as base64 dataurls in the output. This flag is only useful for the HTML/WebPDF/Slides exports.\n",
" Equivalent to: [--HTMLExporter.embed_images=True]\n",
"--sanitize-html\n",
" Whether the HTML in Markdown cells and cell outputs should be sanitized..\n",
" Equivalent to: [--HTMLExporter.sanitize_html=True]\n",
"--log-level=<Enum>\n",
" Set the log level by value or name.\n",
" Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']\n",
" Default: 30\n",
" Equivalent to: [--Application.log_level]\n",
"--config=<Unicode>\n",
" Full path of a config file.\n",
" Default: ''\n",
" Equivalent to: [--JupyterApp.config_file]\n",
"--to=<Unicode>\n",
" The export format to be used, either one of the built-in formats\n",
" ['asciidoc', 'custom', 'html', 'latex', 'markdown', 'notebook', 'pdf', 'python', 'qtpdf', 'qtpng', 'rst', 'script', 'slides', 'webpdf']\n",
" or a dotted object name that represents the import path for an\n",
" ``Exporter`` class\n",
" Default: ''\n",
" Equivalent to: [--NbConvertApp.export_format]\n",
"--template=<Unicode>\n",
" Name of the template to use\n",
" Default: ''\n",
" Equivalent to: [--TemplateExporter.template_name]\n",
"--template-file=<Unicode>\n",
" Name of the template file to use\n",
" Default: None\n",
" Equivalent to: [--TemplateExporter.template_file]\n",
"--theme=<Unicode>\n",
" Template specific theme(e.g. the name of a JupyterLab CSS theme distributed\n",
" as prebuilt extension for the lab template)\n",
" Default: 'light'\n",
" Equivalent to: [--HTMLExporter.theme]\n",
"--sanitize_html=<Bool>\n",
" Whether the HTML in Markdown cells and cell outputs should be sanitized.This\n",
" should be set to True by nbviewer or similar tools.\n",
" Default: False\n",
" Equivalent to: [--HTMLExporter.sanitize_html]\n",
"--writer=<DottedObjectName>\n",
" Writer class used to write the\n",
" results of the conversion\n",
" Default: 'FilesWriter'\n",
" Equivalent to: [--NbConvertApp.writer_class]\n",
"--post=<DottedOrNone>\n",
" PostProcessor class used to write the\n",
" results of the conversion\n",
" Default: ''\n",
" Equivalent to: [--NbConvertApp.postprocessor_class]\n",
"--output=<Unicode>\n",
" Overwrite base name use for output files.\n",
" Supports pattern replacements '{notebook_name}'.\n",
" Default: '{notebook_name}'\n",
" Equivalent to: [--NbConvertApp.output_base]\n",
"--output-dir=<Unicode>\n",
" Directory to write output(s) to. Defaults\n",
" to output to the directory of each notebook. To recover\n",
" previous default behaviour (outputting to the current\n",
" working directory) use . as the flag value.\n",
" Default: ''\n",
" Equivalent to: [--FilesWriter.build_directory]\n",
"--reveal-prefix=<Unicode>\n",
" The URL prefix for reveal.js (version 3.x).\n",
" This defaults to the reveal CDN, but can be any url pointing to a copy\n",
" of reveal.js.\n",
" For speaker notes to work, this must be a relative path to a local\n",
" copy of reveal.js: e.g., \"reveal.js\".\n",
" If a relative path is given, it must be a subdirectory of the\n",
" current directory (from which the server is run).\n",
" See the usage documentation\n",
" (https://nbconvert.readthedocs.io/en/latest/usage.html#reveal-js-html-slideshow)\n",
" for more details.\n",
" Default: ''\n",
" Equivalent to: [--SlidesExporter.reveal_url_prefix]\n",
"--nbformat=<Enum>\n",
" The nbformat version to write.\n",
" Use this to downgrade notebooks.\n",
" Choices: any of [1, 2, 3, 4]\n",
" Default: 4\n",
" Equivalent to: [--NotebookExporter.nbformat_version]\n",
"\n",
"Examples\n",
"--------\n",
"\n",
" The simplest way to use nbconvert is\n",
"\n",
" > jupyter nbconvert mynotebook.ipynb --to html\n",
"\n",
" Options include ['asciidoc', 'custom', 'html', 'latex', 'markdown', 'notebook', 'pdf', 'python', 'qtpdf', 'qtpng', 'rst', 'script', 'slides', 'webpdf'].\n",
"\n",
" > jupyter nbconvert --to latex mynotebook.ipynb\n",
"\n",
" Both HTML and LaTeX support multiple output templates. LaTeX includes\n",
" 'base', 'article' and 'report'. HTML includes 'basic', 'lab' and\n",
" 'classic'. You can specify the flavor of the format used.\n",
"\n",
" > jupyter nbconvert --to html --template lab mynotebook.ipynb\n",
"\n",
" You can also pipe the output to stdout, rather than a file\n",
"\n",
" > jupyter nbconvert mynotebook.ipynb --stdout\n",
"\n",
" PDF is generated via latex\n",
"\n",
" > jupyter nbconvert mynotebook.ipynb --to pdf\n",
"\n",
" You can get (and serve) a Reveal.js-powered slideshow\n",
"\n",
" > jupyter nbconvert myslides.ipynb --to slides --post serve\n",
"\n",
" Multiple notebooks can be given at the command line in a couple of\n",
" different ways:\n",
"\n",
" > jupyter nbconvert notebook*.ipynb\n",
" > jupyter nbconvert notebook1.ipynb notebook2.ipynb\n",
"\n",
" or you can specify the notebooks list in a config file, containing::\n",
"\n",
" c.NbConvertApp.notebooks = [\"my_notebook.ipynb\"]\n",
"\n",
" > jupyter nbconvert --config mycfg.py\n",
"\n",
"To see all available configurables, use `--help-all`.\n",
"\n"
"[NbConvertApp] Converting notebook mnist_classifier.ipynb to script\n",
"[NbConvertApp] Writing 4263 bytes to mnist_classifier.py\n"
]
}
],
"source": [
"# !jupyter nbconvert --to script mnist.ipynb\n",
"!jupyter nbconvert --to script --TagRemovePreprocessor.remove_cell_tags=\"exclude\" --TemplateExporter.exclude_input_prompt=True mnist.ipynb\n",
"!jupyter nbconvert --to script --TagRemovePreprocessor.remove_cell_tags=\"exclude\" --TemplateExporter.exclude_input_prompt=True mnist_classifier.ipynb\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"exclude"
]
},
"outputs": [],
"source": [
"# from IPython.display import HTML, display, Image\n",
"# %%html\n",
"# <style>\n",
"# #whiteboard {\n",
"# border: 3px solid black;\n",
"# border-radius: 6px; \n",
"# background-color: #FFFFFF;\n",
"# }\n",
"# #capture-button {\n",
"# background-color: #3F52D9; \n",
"# color: white;\n",
"# border: none;\n",
"# padding: 10px 20px;\n",
"# cursor: pointer;\n",
"# font-size: 16px;\n",
"# border-radius: 3px;\n",
"# margin-top: 10px;\n",
"# width: 190px;\n",
"# margin-right: 20px;\n",
"# }\n",
"# #clear-button {\n",
"# background-color: #FF0000,; \n",
"# color: black;\n",
"# border: none;\n",
"# padding: 10px 20px;\n",
"# cursor: pointer;\n",
"# font-size: 16px;\n",
"# border-radius: 3px;\n",
"# margin-top: 10px;\n",
"# width: 190px;\n",
"# }\n",
"# #container {\n",
"# display: flex;\n",
"# flex-direction: column; /* Arrange children vertically */\n",
"# align-items: center; /* Center horizontally */\n",
"# justify-content: center;\n",
"# }\n",
"# #btn-container {\n",
"# display: flex;\n",
"# flex-direction: row; /* Arrange children vertically */\n",
"# align-items: center; /* Center horizontally */\n",
"# }\n",
"\n",
"# </style>\n",
"# <div id='container'>\n",
"# <canvas id=\"whiteboard\" width=\"400\" height=\"200\" fill_rect='white'></canvas>\n",
"# <div id='btn-container'>\n",
"# <button id=\"capture-button\">Predict</button>\n",
"# <button id=\"clear-button\">Clear</button>\n",
"# </div>\n",
"\n",
"# </div>\n",
"# <script>\n",
"# var canvas = document.getElementById('whiteboard');\n",
"# var context = canvas.getContext('2d');\n",
"# var drawing = false;\n",
"# canvas.addEventListener('mousedown', function (e) {\n",
"# drawing = true;\n",
"# context.beginPath();\n",
"# context.moveTo(e.clientX - canvas.getBoundingClientRect().left, e.clientY - canvas.getBoundingClientRect().top);\n",
"# });\n",
"# canvas.addEventListener('mousemove', function (e) {\n",
"# if (drawing) {\n",
"# context.lineTo(e.clientX - canvas.getBoundingClientRect().left, e.clientY - canvas.getBoundingClientRect().top);\n",
"# context.stroke();\n",
"# }\n",
"# });\n",
"# canvas.addEventListener('mouseup', function () {\n",
"# drawing = false;\n",
"# });\n",
"# canvas.addEventListener('mouseout', function () {\n",
"# drawing = false;\n",
"# });\n",
" \n",
"# var clearButton = document.getElementById('clear-button');\n",
"# clearButton.addEventListener('click', function () {\n",
"# context.clearRect(0, 0, canvas.width, canvas.height);\n",
"# });\n",
"\n",
"# var captureButton = document.getElementById('capture-button');\n",
"# captureButton.addEventListener('click', function () {\n",
"# // Convert the canvas content to a data URL (image)\n",
"# var imageData = canvas.toDataURL(\"image/png\");\n",
"\n",
"# // Send the image data to the Jupyter kernel variable\n",
"# IPython.notebook.kernel.execute('image_data = \"' + imageData + '\"');\n",
"# });\n",
"# </script>\n"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down

0 comments on commit 8edb87f

Please sign in to comment.