Instructions to use glowforge-dev/stable-diffusion-2-1-img2img-jonathan2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use glowforge-dev/stable-diffusion-2-1-img2img-jonathan2 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("glowforge-dev/stable-diffusion-2-1-img2img-jonathan2", 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
Commit ·
20b727c
1
Parent(s): e4d55ce
add additional parameters
Browse files- README.md +6 -0
- handler.py +1 -1
README.md
CHANGED
|
@@ -7,6 +7,12 @@ widget:
|
|
| 7 |
- src: >-
|
| 8 |
https://huggingface.co/datasets/mishig/sample_images/resolve/main/canny-edge.jpg
|
| 9 |
prompt: Girl with Pearl Earring
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
duplicated_from: stabilityai/stable-diffusion-2-1-base
|
| 11 |
---
|
| 12 |
|
|
|
|
| 7 |
- src: >-
|
| 8 |
https://huggingface.co/datasets/mishig/sample_images/resolve/main/canny-edge.jpg
|
| 9 |
prompt: Girl with Pearl Earring
|
| 10 |
+
num_inference_steps: ''
|
| 11 |
+
guidance_scale: ''
|
| 12 |
+
negative_prompt: ''
|
| 13 |
+
height: ''
|
| 14 |
+
width: ''
|
| 15 |
+
manual_seed: ''
|
| 16 |
duplicated_from: stabilityai/stable-diffusion-2-1-base
|
| 17 |
---
|
| 18 |
|
handler.py
CHANGED
|
@@ -51,7 +51,7 @@ class EndpointHandler():
|
|
| 51 |
|
| 52 |
out = None
|
| 53 |
|
| 54 |
-
if data.get("
|
| 55 |
generator = torch.Generator(device='cuda')
|
| 56 |
generator.manual_seed(manual_seed)
|
| 57 |
# run img2img pipeline
|
|
|
|
| 51 |
|
| 52 |
out = None
|
| 53 |
|
| 54 |
+
if data.get("src"):
|
| 55 |
generator = torch.Generator(device='cuda')
|
| 56 |
generator.manual_seed(manual_seed)
|
| 57 |
# run img2img pipeline
|