!pip install --upgrade diffusers transformers scipy &> /dev/null

import matplotlib.pyplot as plt
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline
from diffusers import StableDiffusionImg2ImgPipeline

hub_token = 'YOUR_TOKEN_GOES_HERE'
img2img = True # Set to False if you don't want to do img2img

if img2img:
    pipe = StableDiffusionImg2ImgPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", 
                                                   revision="fp16", 
                                                   torch_dtype=torch.float16, 
                                                   use_auth_token=hub_token) 
else:
    pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", 
                                                   revision="fp16", 
                                                   torch_dtype=torch.float16, 
                                                   use_auth_token=hub_token) 
def safety_checker(images, clip_input):
    return images, False
pipe.safety_checker = safety_checker
{}
region:us
TAGS
#region-us 

!pip install --upgrade diffusers transformers scipy &> /dev/null

import URL as plt
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline
from diffusers import StableDiffusionImg2ImgPipeline

hub_token = 'YOUR_TOKEN_GOES_HERE'
img2img = True # Set to False if you don't want to do img2img

if img2img:
    pipe = StableDiffusionImg2ImgPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", 
                                                   revision="fp16", 
                                                   torch_dtype=torch.float16, 
                                                   use_auth_token=hub_token) 
else:
    pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", 
                                                   revision="fp16", 
                                                   torch_dtype=torch.float16, 
                                                   use_auth_token=hub_token) 
def safety_checker(images, clip_input):
    return images, False
pipe.safety_checker = safety_checker
# Set to False if you don't want to do img2img

if img2img:
    pipe = StableDiffusionImg2ImgPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", 
                                                   revision="fp16", 
                                                   torch_dtype=torch.float16, 
                                                   use_auth_token=hub_token) 
else:
    pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", 
                                                   revision="fp16", 
                                                   torch_dtype=torch.float16, 
                                                   use_auth_token=hub_token) 
def safety_checker(images, clip_input):
    return images, False
pipe.safety_checker = safety_checker
TAGS
#region-us 
 # Set to False if you don't want to do img2img

if img2img:
    pipe = StableDiffusionImg2ImgPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", 
                                                   revision="fp16", 
                                                   torch_dtype=torch.float16, 
                                                   use_auth_token=hub_token) 
else:
    pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", 
                                                   revision="fp16", 
                                                   torch_dtype=torch.float16, 
                                                   use_auth_token=hub_token) 
def safety_checker(images, clip_input):
    return images, False
pipe.safety_checker = safety_checker
TAGS
#region-us 
# Set to False if you don't want to do img2img

if img2img:
    pipe = StableDiffusionImg2ImgPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", 
                                                   revision="fp16", 
                                                   torch_dtype=torch.float16, 
                                                   use_auth_token=hub_token) 
else:
    pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", 
                                                   revision="fp16", 
                                                   torch_dtype=torch.float16, 
                                                   use_auth_token=hub_token) 
def safety_checker(images, clip_input):
    return images, False
pipe.safety_checker = safety_checker