Spaces:
Runtime error
Runtime error
File size: 528 Bytes
14c49ec 0d82919 14c49ec 0d82919 14c49ec 0d82919 14c49ec 0d82919 14c49ec | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | import torch
from diffusers import DiffusionPipeline
pipe = None
def load_model():
print('Loading model...')
global pipe
print('Model loaded!')
if pipe is None:
print('Loading model... 2')
pipe = DiffusionPipeline.from_pretrained(
"stablediffusionapi/deliberate-v2",
torch_dtype=torch.float16
).to("cuda")
print('Model loaded! 2')
return pipe
def generate(prompt: str):
pipe = load_model()
image = pipe(prompt).images[0]
return image |