Basic SDXL text to image generation
This commit is contained in:
commit
817329ff04
124
text-to-image.ipynb
Normal file
124
text-to-image.ipynb
Normal file
File diff suppressed because one or more lines are too long
17
text-to-image.py
Normal file
17
text-to-image.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import torch
|
||||||
|
|
||||||
|
from diffusers import StableDiffusionXLPipeline
|
||||||
|
|
||||||
|
pipe = StableDiffusionXLPipeline.from_pretrained(
|
||||||
|
'stabilityai/stable-diffusion-xl-base-1.0',
|
||||||
|
torch_dtype=torch.float16,
|
||||||
|
use_safetensors=True,
|
||||||
|
variant='fp16')
|
||||||
|
pipe.to('cuda')
|
||||||
|
|
||||||
|
def generate_image(prompt: str):
|
||||||
|
return pipe(prompt=prompt, num_inference_steps=20).images[0]
|
||||||
|
|
||||||
|
image = generate_image('cthulhu, paper craft art, minimal detail')
|
||||||
|
image.show()
|
||||||
|
# image.save('image.png')
|
Loading…
Reference in New Issue
Block a user