Instructions to use peter-sushko/RealEdit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use peter-sushko/RealEdit with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("peter-sushko/RealEdit", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse filesadded download link
README.md
CHANGED
|
@@ -23,9 +23,7 @@ Install diffusers, transformers library:
|
|
| 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 |
-
|
| 27 |
-
|
| 28 |
-
WEIGHTS
|
| 29 |
|
| 30 |
|
| 31 |
```python
|
|
@@ -42,7 +40,16 @@ pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(
|
|
| 42 |
pipe.to("cuda")
|
| 43 |
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 44 |
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
prompt = "give him a crown"
|
| 47 |
|
| 48 |
result = pipe(prompt, image=image, num_inference_steps=50, image_guidance_scale=2).images[0]
|
|
|
|
| 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
|
|
|
|
| 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)
|
| 49 |
+
image = image.convert("RGB")
|
| 50 |
+
return image
|
| 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]
|