Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## Quick Start
|
2 |
+
Make sure to install the libraries first:
|
3 |
+
|
4 |
+
```bash
|
5 |
+
pip install accelerate transformers
|
6 |
+
pip install git+https://github.com/huggingface/diffusers
|
7 |
+
```
|
8 |
+
|
9 |
+
```python
|
10 |
+
import torch
|
11 |
+
from diffusers import StableDiffusionXLInstructPix2PixPipeline
|
12 |
+
from diffusers.utils import load_image
|
13 |
+
resolution = 768
|
14 |
+
image = load_image(
|
15 |
+
"https://hf.co/datasets/diffusers/diffusers-images-docs/resolve/main/mountain.png"
|
16 |
+
).resize((resolution, resolution))
|
17 |
+
edit_instruction = "Turn sky into a cloudy one"
|
18 |
+
pipe = StableDiffusionXLInstructPix2PixPipeline.from_pretrained(
|
19 |
+
"UCSC-VLAA/HQ-Edit", torch_dtype=torch.float16
|
20 |
+
).to("cuda")
|
21 |
+
edited_image = pipe(
|
22 |
+
prompt=edit_instruction,
|
23 |
+
image=image,
|
24 |
+
height=resolution,
|
25 |
+
width=resolution,
|
26 |
+
guidance_scale=3.0,
|
27 |
+
image_guidance_scale=1.5,
|
28 |
+
num_inference_steps=30,
|
29 |
+
).images[0]
|
30 |
+
edited_image.save("edited_image.png")
|
31 |
+
```
|