Jupiter notebook unable to login

Based upon samples here the first part of my code runs fine no errors :

API_TOKEN = "hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  #(I retrieved a key)
model = "gpt2"
model = "CompVis/stable-diffusion-v1-4"
import json
import requests
API_URL = "https://api-inference.huggingface.co/models/"+model
headers = {"Authorization": f"Bearer {API_TOKEN}"}
def query(payload):
    data = json.dumps(payload)
    response = requests.request("POST", API_URL, headers=headers, data=data)
    return json.loads(response.content.decode("utf-8"))
data = query("Can you please let us know more details about your ")

However the second part returns an error :

import torch
from torch import autocast
from diffusers import StableDiffusionPipeline
model_id = "CompVis/stable-diffusion-v1-4"
device = "cuda"

pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True)
pipe = pipe.to(device)
prompt = "a photo of an astronaut riding a horse on mars"
with autocast("cuda"):
    image = pipe(prompt, guidance_scale=7.5).images[0]  

The error raised is :

OSError                                   Traceback (most recent call last)
/tmp/ipykernel_84/3423739988.py in <module>
----> 9 pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True)
     10 pipe = pipe.to(device)

/opt/conda/lib/python3.8/site-packages/diffusers/pipeline_utils.py in from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
    286         # use snapshot download here to get it working from from_pretrained
    287         if not os.path.isdir(pretrained_model_name_or_path):
--> 288             cached_folder = snapshot_download(
    289                 pretrained_model_name_or_path,
    290                 cache_dir=cache_dir,

/opt/conda/lib/python3.8/site-packages/huggingface_hub/utils/_deprecation.py in inner_f(*args, **kwargs)
     91                     message += "\n\n" + custom_message
     92                 warnings.warn(message, FutureWarning)
---> 93             return f(*args, **kwargs)
     95         return inner_f

/opt/conda/lib/python3.8/site-packages/huggingface_hub/_snapshot_download.py in snapshot_download(repo_id, revision, repo_type, cache_dir, library_name, library_version, user_agent, proxies, etag_timeout, resume_download, use_auth_token, local_files_only, allow_regex, ignore_regex, allow_patterns, ignore_patterns)
    113         token = HfFolder.get_token()
    114         if token is None:
--> 115             raise EnvironmentError(
    116                 "You specified use_auth_token=True, but a Hugging Face token was not"
    117                 " found."

OSError: You specified use_auth_token=True, but a Hugging Face token was not found.

I’m running a Docker container (with cuda support) ubuntu inside windows 11.
I retrieved a Read token, but i seam unable to make use of it.
Any help would be great.

it worked after i added in a new yupiter code cell the following

from huggingface_hub import notebook_login