patrickvonplaten commited on
Commit
b795ca9
1 Parent(s): 8628cf3
Files changed (2) hide show
  1. fantasy_landscape.png +3 -0
  2. run.py +15 -10
fantasy_landscape.png ADDED

Git LFS Details

  • SHA256: aeb3ba81e1cce0d705f0e88de9552f2c1c81ff83e93bd2736783a99e220a63af
  • Pointer size: 131 Bytes
  • Size of remote file: 856 kB
run.py CHANGED
@@ -1,16 +1,21 @@
1
- #!/usr/bin/env python3
2
- from diffusers import StableDiffusionPipeline
3
  import torch
 
 
4
 
5
- model_ids = ["nitrosocke/Arcane-Diffusion", "nitrosocke/spider-verse-diffusion", "nitrosocke/mo-di-diffusion", "nitrosocke/archer-diffusion", "nitrosocke/elden-ring-diffusion"]
6
- prompts = ["arcane style", "spiderverse style", "modern disney style", "archer style", "elden ring style"]
7
 
 
 
 
8
 
9
- for model_id, prompt in zip(model_ids, prompts):
10
- pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
11
- pipe = pipe.to("cuda")
12
 
13
- prompt = f"a magical princess with golden hair, {prompt}"
14
- image = pipe(prompt).images[0]
 
15
 
16
- image.save(f"./magical_princess_{model_id.split('/')[-1]}.png")
 
 
 
 
1
+ import requests
 
2
  import torch
3
+ from PIL import Image
4
+ from io import BytesIO
5
 
6
+ from diffusers import StableUnCLIPImg2ImgPipeline
 
7
 
8
+ pipe = StableUnCLIPImg2ImgPipeline.from_pretrained("/home/patrick_huggingface_co/stable-diffusion-2-1-unclip", torch_dtype=torch.float16
9
+ ) # TODO update model path
10
+ pipe = pipe.to("cuda")
11
 
12
+ url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"
 
 
13
 
14
+ response = requests.get(url)
15
+ init_image = Image.open(BytesIO(response.content)).convert("RGB")
16
+ init_image = init_image.resize((768, 512))
17
 
18
+ prompt = "A fantasy landscape, trending on artstation"
19
+
20
+ images = pipe(prompt, init_image).images
21
+ images[0].save("fantasy_landscape.png")