Update README.md
Browse files
README.md
CHANGED
@@ -1,35 +1,47 @@
|
|
1 |
---
|
2 |
base_model: timbrooks/instruct-pix2pix
|
3 |
library_name: diffusers
|
4 |
-
license:
|
5 |
tags:
|
6 |
- stable-diffusion
|
7 |
- stable-diffusion-diffusers
|
8 |
- text-to-image
|
9 |
- diffusers
|
10 |
- diffusers-training
|
11 |
-
- lora
|
12 |
inference: true
|
|
|
|
|
|
|
|
|
13 |
---
|
14 |
|
15 |
-
|
16 |
-
should probably proofread and complete it, then remove this comment. -->
|
17 |
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
## Intended uses & limitations
|
22 |
-
|
23 |
-
#### How to use
|
24 |
|
25 |
```python
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
base_model: timbrooks/instruct-pix2pix
|
3 |
library_name: diffusers
|
4 |
+
license: apache-2.0
|
5 |
tags:
|
6 |
- stable-diffusion
|
7 |
- stable-diffusion-diffusers
|
8 |
- text-to-image
|
9 |
- diffusers
|
10 |
- diffusers-training
|
|
|
11 |
inference: true
|
12 |
+
datasets:
|
13 |
+
- SherryXTChen/InstructCLIP-InstructPix2Pix-Data
|
14 |
+
language:
|
15 |
+
- en
|
16 |
---
|
17 |
|
18 |
+
# InstructCLIP: Improving Instruction-Guided Image Editing with Automated Data Refinement Using Contrastive Learning
|
|
|
19 |
|
20 |
+
GitHub: https://github.com/SherryXTChen/InstructCLIP.git
|
21 |
|
22 |
+
## Example
|
|
|
|
|
|
|
|
|
23 |
|
24 |
```python
|
25 |
+
import PIL
|
26 |
+
import requests
|
27 |
+
import torch
|
28 |
+
from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler
|
29 |
+
|
30 |
+
model_id = "timbrooks/instruct-pix2pix"
|
31 |
+
pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
32 |
+
pipe.load_lora_weights("SherryXTChen/InstructCLIP-InstructPix2Pix")
|
33 |
+
pipe.to("cuda")
|
34 |
+
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
35 |
+
|
36 |
+
url = "https://raw.githubusercontent.com/SherryXTChen/Instruct-CLIP/main/assets/1_input.jpg"
|
37 |
+
def download_image(url):
|
38 |
+
image = PIL.Image.open(requests.get(url, stream=True).raw)
|
39 |
+
image = PIL.ImageOps.exif_transpose(image)
|
40 |
+
image = image.convert("RGB")
|
41 |
+
return image
|
42 |
+
image = download_image(url)
|
43 |
+
|
44 |
+
prompt = "as a 3 d sculpture"
|
45 |
+
images = pipe(prompt, image=image, num_inference_steps=20).images
|
46 |
+
images[0].save("output.jpg")
|
47 |
+
```
|