> For the complete documentation index, see [llms.txt](https://ai-docs.fptcloud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-docs.fptcloud.com/fpt-gpu-cloud/gpu-container/use-cases/jupyter-notebook-use-case.md).

# Jupyter Notebook Use Case

{% embed url="<https://www.youtube.com/watch?embeds_referring_euri=https://cdn.iframe.ly/&source_ve_path=Mjg2NjQsOTY3MTQ&v=IenVwz7iqfs>" %}

1. Create a GPU Container using Jupyter Notebook template&#x20;

   <figure><img src="/files/R9ZgAvuS6Nwq2g9vygaF" alt=""><figcaption></figcaption></figure>

   <figure><img src="/files/rr9Ve4hAEEMEfLpYEX7D" alt=""><figcaption></figcaption></figure>

   <figure><img src="/files/ZKXDGN53UZYdOOEX56vO" alt=""><figcaption></figcaption></figure>

2. Pulling YOLOv8 model using terminal in Jupyter Notebook&#x20;

**Step 1:** Setup environment to run YOLO models, in this lab, we will use YOLOv8 to detect type of animals&#x20;

<pre><code>!pip install ultralytics 
<strong>!apt update &#x26;&#x26; apt install -y libglib2.0-0 libgl1 
</strong></code></pre>

<figure><img src="/files/4e9VqjwzbPhLvQPorfiU" alt=""><figcaption></figcaption></figure>

**Step 2**: Install YOLOv8&#x20;

```
from ultralytics import YOLO  
import cv2  
import matplotlib.pyplot as plt  
import torch  
model = YOLO("yolov8l.pt") 
```

<figure><img src="/files/BD0Pxv22BxDe1MAa3j8s" alt=""><figcaption></figcaption></figure>

**Step 3**: Load model into NVIDIA GPU H100 then check whether the model is using correct GPU&#x20;

```
model.to("cuda") 
print("Model device:", model.device)  
print("GPU available:", torch.cuda.is_available())  
print("GPU name:", torch.cuda.get_device_name(0) if torch.cuda.is_available() else "No GPU")  
print("Current device:", torch.cuda.current_device() if torch.cuda.is_available() else "None") 
```

<figure><img src="/files/VA87aZGsq82HI4Fqkck1" alt=""><figcaption></figcaption></figure>

**Step 4**: Object detecting using YOLOv8: load an image of some animals into the current workspace, run command below to detect the type of animals in the picture&#x20;

{% hint style="info" %}
*<mark style="color:blue;">Notice: the picture "640px-MountainLion.jpg" in this demo is pushed from local, please upload your own image and replace into the img\_path before running</mark>*&#x20;
{% endhint %}

```
img_path = "640px-MountainLion.jpg"  
results = model(img_path) 
allocated = torch.cuda.memory_allocated() / 10242 
reserved = torch.cuda.memory_reserved() / 10242 
print(f"Memory allocated: {allocated:.2f} MB")  
print(f"Memory reserved: {reserved:.2f} MB") 
results[0].show() 
```

<figure><img src="/files/aJzPupxz95sT8QSE093N" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ai-docs.fptcloud.com/fpt-gpu-cloud/gpu-container/use-cases/jupyter-notebook-use-case.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
