Update README.md
Browse files
README.md
CHANGED
|
@@ -11,7 +11,6 @@ Data: https://huggingface.co/datasets/peter-sushko/RealEdit
|
|
| 11 |
<img src="https://peter-sushko.github.io/RealEdit/static/images/teaser.svg"/>
|
| 12 |
|
| 13 |
|
| 14 |
-
|
| 15 |
**There are 2 ways to run inference: either via Diffusers or original InstructPix2Pix pipeline.**
|
| 16 |
|
| 17 |
## Option 1: With 🧨Diffusers:
|
|
@@ -22,10 +21,8 @@ Install diffusers, transformers library:
|
|
| 22 |
# Install required libraries
|
| 23 |
pip install torch==2.7.0 diffusers==0.33.1 transformers==4.51.3 accelerate==1.6.0 pillow==11.2.1
|
| 24 |
```
|
| 25 |
-
|
| 26 |
Then run:
|
| 27 |
|
| 28 |
-
|
| 29 |
```python
|
| 30 |
import torch
|
| 31 |
from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler
|
|
@@ -40,9 +37,7 @@ pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(
|
|
| 40 |
pipe.to("cuda")
|
| 41 |
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 42 |
|
| 43 |
-
|
| 44 |
url = "https://github.com/AyanaBharadwaj/RealEdit/blob/main/example_imgs/simba.jpg"
|
| 45 |
-
|
| 46 |
def download_image(url):
|
| 47 |
image = PIL.Image.open(requests.get(url, stream=True).raw)
|
| 48 |
image = PIL.ImageOps.exif_transpose(image)
|
|
@@ -51,7 +46,6 @@ def download_image(url):
|
|
| 51 |
image = download_image(url)
|
| 52 |
|
| 53 |
prompt = "give him a crown"
|
| 54 |
-
|
| 55 |
result = pipe(prompt, image=image, num_inference_steps=50, image_guidance_scale=2).images[0]
|
| 56 |
result.save("output.png")
|
| 57 |
```
|
|
|
|
| 11 |
<img src="https://peter-sushko.github.io/RealEdit/static/images/teaser.svg"/>
|
| 12 |
|
| 13 |
|
|
|
|
| 14 |
**There are 2 ways to run inference: either via Diffusers or original InstructPix2Pix pipeline.**
|
| 15 |
|
| 16 |
## Option 1: With 🧨Diffusers:
|
|
|
|
| 21 |
# Install required libraries
|
| 22 |
pip install torch==2.7.0 diffusers==0.33.1 transformers==4.51.3 accelerate==1.6.0 pillow==11.2.1
|
| 23 |
```
|
|
|
|
| 24 |
Then run:
|
| 25 |
|
|
|
|
| 26 |
```python
|
| 27 |
import torch
|
| 28 |
from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler
|
|
|
|
| 37 |
pipe.to("cuda")
|
| 38 |
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 39 |
|
|
|
|
| 40 |
url = "https://github.com/AyanaBharadwaj/RealEdit/blob/main/example_imgs/simba.jpg"
|
|
|
|
| 41 |
def download_image(url):
|
| 42 |
image = PIL.Image.open(requests.get(url, stream=True).raw)
|
| 43 |
image = PIL.ImageOps.exif_transpose(image)
|
|
|
|
| 46 |
image = download_image(url)
|
| 47 |
|
| 48 |
prompt = "give him a crown"
|
|
|
|
| 49 |
result = pipe(prompt, image=image, num_inference_steps=50, image_guidance_scale=2).images[0]
|
| 50 |
result.save("output.png")
|
| 51 |
```
|