> For the complete documentation index, see [llms.txt](https://runyourai.gitbook.io/eng-runyourai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://runyourai.gitbook.io/eng-runyourai/tutorial/using-jupyter-ai-labs.md).

# Using Jupyter AI Labs

Explore JupyterAI with ease using the guide!

<figure><img src="https://1302126628-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJxCl6pdCJeZcbGEegBNj%2Fuploads%2FmaYIEtl7GcYnLq4ANsGG%2F%EC%8A%A4%ED%81%AC%EB%A6%B0%EC%83%B7%202024-07-08%20155541.png?alt=media&amp;token=620a5bf9-d61f-4cb7-b980-f9fc8a8d78f1" alt=""><figcaption></figcaption></figure>

{% hint style="info" %} <mark style="color:red;">**What is Jupyter AI?**</mark>

Jupyter AI is an extension program that provides an environment in which AI can be easily utilized within Jupyter notebooks.
{% endhint %}

**What can you do with Jupyter AI?**

✔️ Generate code using generative AI models within Jupyter notebook kernels.

✔️ Chat with generative AI using a chat UI within Jupyter Lab.

✔️ Utilize various generative models including OpenAI, Hugging Face, Gemini, and more.

**Try out Jupyter AI right now using the&#x20;**<mark style="background-color:yellow;">**templates**</mark>**&#x20;provided by runyour AI!**

***

## Step 1. Machine Rental / Template Selection&#x20;

<figure><img src="https://1302126628-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJxCl6pdCJeZcbGEegBNj%2Fuploads%2FmYZ8h9A53DlQB2tKIlcI%2F%EC%8A%A4%ED%81%AC%EB%A6%B0%EC%83%B7%202024-07-08%20162841.png?alt=media&amp;token=8de7ad27-422c-47e3-80b9-48b3b96c96a0" alt=""><figcaption></figcaption></figure>

* When you select your desired machine from the GPU Cloud list, you will proceed to the template selection step. Choose the jupyter-AI-Labs template and click the rent button at the top.
* You can check the rented machine on <mark style="background-color:yellow;">My Page > Dashboard.</mark>

***

## Step 2. Access to Jupyter Lab WebUI

<figure><img src="https://1302126628-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJxCl6pdCJeZcbGEegBNj%2Fuploads%2FjLLYFweM7ejIqEaZaE1H%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202025-07-24%20%E1%84%8B%E1%85%A9%E1%84%8C%E1%85%A5%E1%86%AB%2010.51.19.png?alt=media&amp;token=65d0b49e-169b-4d68-9b1c-4f2f6903fc11" alt=""><figcaption></figcaption></figure>

* If you click on the rented machine, you can check the SSH / Web UI access function and the PEM key download function.

<figure><img src="https://1302126628-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJxCl6pdCJeZcbGEegBNj%2Fuploads%2FrHTC1snDyCxAS3QEI8L9%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202025-07-24%20%E1%84%8B%E1%85%A9%E1%84%8C%E1%85%A5%E1%86%AB%2010.52.34.png?alt=media&amp;token=3aa4e5c0-de5f-459d-a555-a8fb0df0349d" alt=""><figcaption></figcaption></figure>

* Click the SSH / WEB button among the two buttons.

<figure><img src="https://1302126628-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJxCl6pdCJeZcbGEegBNj%2Fuploads%2FnI6yPBnQyAhywQrGoh1Z%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202025-07-24%20%E1%84%8B%E1%85%A9%E1%84%8C%E1%85%A5%E1%86%AB%2010.54.01.png?alt=media&amp;token=ef6a848c-b14a-4b56-99b9-2bd816d9741f" alt=""><figcaption></figcaption></figure>

* Among the two access methods, click the 'HTTP' > 'Jupyter Lab' button to access the Web UI directly.

## Step 3. Utilize OpenAI API using Jupyter AI

### 1. Create Jupyter Notebook to use

Click the <mark style="color:red;">**Notebook > Python 3**</mark> button on the screen and create a new notebook file.

<figure><img src="https://1302126628-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJxCl6pdCJeZcbGEegBNj%2Fuploads%2FNGMv5YoEb6tO6YABhBHc%2Fpython2.png?alt=media&amp;token=a7a5ca21-216c-4e8f-b4f4-8b2a608fc5e8" alt=""><figcaption></figcaption></figure>

### 2. Enter the following Code on the notebook file.

```
%reload_ext jupyter_ai
```

### 3. Enter the Key issued by OpenAI.

```
import os
os.environ['OPENAI_API_KEY']='enter the Key issued by OpenAI'
```

### 4. You can use the Chat GPT by using the following code.

{% hint style="info" %}
The generated results may vary depending on ChatGPT's responses.
{% endhint %}

1. Line Graph Example

```
%%ai chatgpt --format code
Demonstrate how to plot a line graph based on a pandas dataset, including sample data
```

* **Result**

<figure><img src="https://1302126628-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJxCl6pdCJeZcbGEegBNj%2Fuploads%2FcpfcECd95GKlFCuE31Zh%2F%EC%8A%A4%ED%81%AC%EB%A6%B0%EC%83%B7%202024-07-08%20162503.png?alt=media&amp;token=80d3662e-e053-4d5a-b861-2d71d4194697" alt=""><figcaption></figcaption></figure>

2. Scatter Graph Example

```
%%ai chatgpt --format code
Demonstrate how to plot a scatter graph based on a pandas dataset, including sample data
```

* **Result**

<figure><img src="https://1302126628-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJxCl6pdCJeZcbGEegBNj%2Fuploads%2F3RWZbNydjegLX8mIIfou%2F%EC%8A%A4%ED%81%AC%EB%A6%B0%EC%83%B7%202024-07-08%20162533.png?alt=media&amp;token=1f6fb33a-de47-4343-98db-bab6fa970f38" alt=""><figcaption></figcaption></figure>

* **Result**

<figure><img src="https://1302126628-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJxCl6pdCJeZcbGEegBNj%2Fuploads%2Ffphxfm4D4FQ3yeBZH1hq%2F%EC%8A%A4%ED%81%AC%EB%A6%B0%EC%83%B7%202024-07-08%20162541.png?alt=media&amp;token=762f8dc8-44a7-4c30-8e16-4cb616d3ae8a" alt=""><figcaption></figcaption></figure>
