Wa0028.
Wa0028.
ipynb - Colab
Generative AI CSE3348
Name: Pankaj Silot
20211cse0730
7CSE15
https://colab.research.google.com/drive/1ZvDUeFYe5dyDR219frV3OwvKw2YcswRC#scrollTo=fsqsjMjHNReB&printMode=true 1/5
12/4/24, 11:18 AM Sha_LS_13a_and_13b.ipynb - Colab
import os
api_key = os.getenv('OPENAI_API_KEY')
sk-VTZGcU2zYRjmcUOEUNqG4J9HUvwMlMJg_WGdUa01WST3BlbkFJcC_CHLnJDt26s
import openai
import requests
from PIL import Image
import io
https://colab.research.google.com/drive/1ZvDUeFYe5dyDR219frV3OwvKw2YcswRC#scrollTo=fsqsjMjHNReB&printMode=true 2/5
12/4/24, 11:18 AM Sha_LS_13a_and_13b.ipynb - Colab
https://colab.research.google.com/drive/1ZvDUeFYe5dyDR219frV3OwvKw2YcswRC#scrollTo=fsqsjMjHNReB&printMode=true 3/5
12/4/24, 11:18 AM Sha_LS_13a_and_13b.ipynb - Colab
# Importing PyTorch library, for building and trai
ning neural networks
import torch
The cache for model files in Transformers v4.22.0 has been updated
0/0 [00:00<?, ?it/s]
# Creating pipeline
pipeline = StableDiffusionPipeline.from_pretrained
("CompVis/stable-dif
torch_dtype=torch.fl
/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_aut
The secret `HF_TOKEN` does not exist in your Colab secrets.
To authenticate with the Hugging Face Hub, create a token in your
You will be able to reuse this secret in all of your notebooks.
Please note that authentication is recommended but still optional
warnings.warn(
model_index.json: 100% 541/541 [00:00<00:00, 40.2kB/s]
checkpoint.json: 100%
w, h = imgs[0].size
grid = Image.new('RGB', size = (cols*w,
rows * ))
w
grid_w, grid_h = grid.size
https://colab.research.google.com/drive/1ZvDUeFYe5dyDR219frV3OwvKw2YcswRC#scrollTo=fsqsjMjHNReB&printMode=true 4/5
12/4/24, 11:18 AM Sha_LS_13a_and_13b.ipynb - Colab
images = pipeline(prompt).images
https://colab.research.google.com/drive/1ZvDUeFYe5dyDR219frV3OwvKw2YcswRC#scrollTo=fsqsjMjHNReB&printMode=true 5/5