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 files
README.md
CHANGED
|
@@ -33,15 +33,12 @@ import requests
|
|
| 33 |
import torch
|
| 34 |
from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler
|
| 35 |
|
| 36 |
-
model_id = "
|
| 37 |
pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(model_id, torch_dtype=torch.float16, safety_checker=None)
|
| 38 |
-
|
| 39 |
-
CODE TO RUN IT:
|
| 40 |
-
|
| 41 |
-
|
| 42 |
pipe.to("cuda")
|
| 43 |
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 44 |
|
|
|
|
| 45 |
url = "https://raw.githubusercontent.com/timothybrooks/instruct-pix2pix/main/imgs/example.jpg"
|
| 46 |
def download_image(url):
|
| 47 |
image = PIL.Image.open(requests.get(url, stream=True).raw)
|
|
@@ -50,7 +47,7 @@ def download_image(url):
|
|
| 50 |
return image
|
| 51 |
image = download_image(url)
|
| 52 |
|
| 53 |
-
prompt = "turn him into cyborg"
|
| 54 |
images = pipe(prompt, image=image, num_inference_steps=10, image_guidance_scale=1).images
|
| 55 |
images[0]
|
| 56 |
```
|
|
|
|
| 33 |
import torch
|
| 34 |
from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler
|
| 35 |
|
| 36 |
+
model_id = "peter-sushko/RealEdit"
|
| 37 |
pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(model_id, torch_dtype=torch.float16, safety_checker=None)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
pipe.to("cuda")
|
| 39 |
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 40 |
|
| 41 |
+
<!--
|
| 42 |
url = "https://raw.githubusercontent.com/timothybrooks/instruct-pix2pix/main/imgs/example.jpg"
|
| 43 |
def download_image(url):
|
| 44 |
image = PIL.Image.open(requests.get(url, stream=True).raw)
|
|
|
|
| 47 |
return image
|
| 48 |
image = download_image(url)
|
| 49 |
|
| 50 |
+
prompt = "turn him into cyborg" -->
|
| 51 |
images = pipe(prompt, image=image, num_inference_steps=10, image_guidance_scale=1).images
|
| 52 |
images[0]
|
| 53 |
```
|