Spaces:
Runtime error
Runtime error
| """https://pypi.org/project/diffusers/. | |
| !pip install git+https://github.com/patil-suraj/transformers@ldm-bert | |
| !git clone https://github.com/huggingface/diffusers | |
| !cd diffusers && pip install -e . | |
| !pip install git+file:///content/diffusers | |
| !pip install torch | |
| https://github.com/CompVis/latent-diffusion/blob/main/scripts/txt2img.py | |
| https://medium.com/tag/diffusion-models | |
| !pip install einops | |
| """ | |
| from diffusers import DiffusionPipeline | |
| ldm = DiffusionPipeline.from_pretrained("fu sing/latent-diffusion-text2im-large") | |
| generator = torch.manual_seed(42) | |
| prompt = "A painting of a squirrel eating a burger" | |
| image = ldm([prompt], generator=generator, eta=0.3, guidance_scale=6.0, num_inference_steps=50) | |
| image_processed = image.cpu().permute(0, 2, 3, 1) | |
| image_processed = image_processed * 255. | |
| image_processed = image_processed.numpy().astype(np.uint8) | |
| image_pil = PIL.Image.fromarray(image_processed[0]) | |
| # save image | |
| image_pil.save("test.png") |