Commit c6c659f2 authored by anton-l's avatar anton-l
Browse files

improve the glide example

parent 02cdd683
......@@ -223,6 +223,6 @@ class GLIDE(DiffusionPipeline):
sampled_prev_image = prev_image + prev_variance
image = sampled_prev_image
image = image[0].permute(1, 2, 0)
image = image.permute(0, 2, 3, 1)
return image
......@@ -11,9 +11,10 @@ model_id = "fusing/glide-base"
pipeline = DiffusionPipeline.from_pretrained(model_id)
# run inference (text-conditioned denoising + upscaling)
img = pipeline("a clip art of a hugging face", generator)
img = pipeline("a crayon drawing of a corgi", generator)
# process image to PIL
img = img.squeeze(0)
img = ((img + 1)*127.5).round().clamp(0, 255).to(torch.uint8).cpu().numpy()
image_pil = PIL.Image.fromarray(img)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment