{ "cells": [ { "cell_type": "markdown", "id": "26b5a248", "metadata": {}, "source": [ "## 4. Installing JupyterLab\n", "\n", "This class will show you how to interact with the Hugging Face API using the Python programming language. We'll run code directly in the notebooks online.\n", "\n", "### A few things to keep in mind:\n", "- Each notebook contains code cells, like the one below. To execute the code, click on the cell, then click the play button at the top of the screen (or press `Ctrl + Enter`).\n", "- The cells are structured logically, so run them one after another.\n", "- You can’t break anything, so don’t be afraid to experiment with the cells.\n", "- You’re working with temporary files, which means your work won’t be saved from one session to the next. If you want to keep your work, you can download your notebooks by clicking **File > Download**.\n", "\n", "For those who prefer to run the notebooks on Google Colab, you can [download them here](https://huggingface.co/spaces/JournalistsonHF/first-llm-classifier/tree/main/notebooks).\n", "\n", "If you want to run it on your computer, you can write Python code in your terminal, in a text file and any number of other places. If you’re a skilled programmer who already has a preferred venue for coding, feel free to use it as you work through this class.\n", "\n", "If you’re not, the tool we recommend for beginners is [Project Jupyter](http://jupyter.org/), a browser-based interface where you can write, run, remix, and republish code.\n", "\n", "> ⚠️ Note: This step is optional. We’ll be running all code directly in JupyterLab on Hugging Face. Follow this step only if you prefer to run the code on your local machine—otherwise, you can skip to the next step.\n", "\n", "It is free software that anyone can install and run. It is used by [scientists](http://nbviewer.jupyter.org/github/robertodealmeida/notebooks/blob/master/earth_day_data_challenge/Analyzing%20whale%20tracks.ipynb), [scholars](http://nbviewer.jupyter.org/github/nealcaren/workshop_2014/blob/master/notebooks/5_Times_API.ipynb), [investors](https://github.com/rsvp/fecon235/blob/master/nb/fred-debt-pop.ipynb), and corporations to create and share their research. It is also used by journalists to develop stories and show their work.\n", "\n", "The easiest way to use it is by installing [JupyterLab Desktop](https://github.com/jupyterlab/jupyterlab-desktop), a self-contained application that provides a ready-to-use Python environment with several popular libraries bundled in. \n", "\n", "It can be installed on any operating system with a simple point-and-click interface." ] }, { "cell_type": "code", "execution_count": 2, "id": "c97c32a7-0497-4231-a628-647afdaac68b", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", "
\n" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from IPython.display import HTML\n", "\n", "HTML(\"\"\"\n", "
\n", " \n", "
\n", "\"\"\")" ] }, { "cell_type": "markdown", "id": "d5decd99-55a2-4a56-b88f-1930a6245203", "metadata": {}, "source": [ "The first step is to visit [JupyterLab Desktop’s homepage on GitHub](https://github.com/jupyterlab/jupyterlab-desktop) in your web browser. \n", "\n", "![JupyterLab Desktop homepage](images/jupyter-desktop-repo.png)\n", "\n", "Scroll down to the documentation below the code until you reach the [Installation](https://github.com/jupyterlab/jupyterlab-desktop) section. \n", "\n", "![JupyterLab Desktop download](images/jupyter-desktop-install.png)\n", "\n", "Then pick the link appropriate for your operating system. The installation file is large, so the download might take a while.\n", "\n", "Find the file in your downloads directory and double-click it to begin the installation process. \n", "\n", "Follow the instructions presented by the pop-up windows, sticking to the default options.\n", "\n", "> ⚠️ **Warning** \n", "> Your computer’s operating system might flag the JupyterLab Desktop installer as an unverified or insecure application. Don’t worry. The tool has been vetted by Project Jupyter’s core developers and it’s safe to use. \n", "> If your system is blocking you from installing the tool, you’ll likely need to work around its barriers. For instance, on macOS, this might require [visiting your system’s security settings](https://www.wikihow.com/Install-Software-from-Unsigned-Developers-on-a-Mac) to allow the installation.\n", "\n", "Once JupyterLab Desktop is installed, you can accept the installation wizard’s offer to immediately open the program, or you can search for “Jupyter Lab” in your operating system’s application finder.\n", "\n", "That will open up a new window that looks something like this:\n", "\n", "![JupyterLab Desktop splash screen](images/jupyter-desktop-splash.png)\n", "\n", "> ⚠️ **Warning** \n", "> If you see a warning bar at the bottom of the screen that says you need to install Python, click the link provided to make that happen.\n", "\n", "Click the “New notebook…” button to open the Python interface.\n", "\n", "![JupyterLab new notebook](images/jupyter-desktop-blank.png)\n", "\n", "Welcome to your first Jupyter notebook. Now you’re ready to move on to writing code.\n", "\n", "> 💡 **Note** \n", "> If you’re struggling to make Jupyter work and need help with the basics, \n", "> we recommend you check out [“First Python Notebook”](https://palewi.re/docs/first-python-notebook/), where you can get up to speed.\n", "\n", "**[5. Prompting with Python →](ch5-prompting-with-python.ipynb)**" ] }, { "cell_type": "code", "execution_count": null, "id": "cca91757-438f-4a5f-b3d5-2bdd774278de", "metadata": {}, "outputs": [], "source": [] } ], "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.5" } }, "nbformat": 4, "nbformat_minor": 5 }