Spaces:
Runtime error
Runtime error
Create new file
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from diffusers import DiffusionPipeline
|
2 |
+
|
3 |
+
ldm = DiffusionPipeline.from_pretrained("fusing/latent-diffusion-text2im-large")
|
4 |
+
|
5 |
+
generator = torch.manual_seed(42)
|
6 |
+
|
7 |
+
prompt = "A painting of a squirrel eating a burger"
|
8 |
+
image = ldm([prompt], generator=generator, eta=0.3, guidance_scale=6.0, num_inference_steps=50)
|
9 |
+
|
10 |
+
image_processed = image.cpu().permute(0, 2, 3, 1)
|
11 |
+
image_processed = image_processed * 255.
|
12 |
+
image_processed = image_processed.numpy().astype(np.uint8)
|
13 |
+
image_pil = PIL.Image.fromarray(image_processed[0])
|
14 |
+
|
15 |
+
# save image
|
16 |
+
image_pil.save("test.png")
|