https://github.com/kadirnar/diffusersplus
This project is under development.
https://github.com/kadirnar/diffusersplus
controlnet diffusers diffusion diffusion-models stable-diffusion
Last synced: about 2 hours ago
JSON representation
This project is under development.
- Host: GitHub
- URL: https://github.com/kadirnar/diffusersplus
- Owner: kadirnar
- License: apache-2.0
- Created: 2023-06-07T17:48:45.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-20T15:55:10.000Z (over 2 years ago)
- Last Synced: 2025-04-10T02:11:46.230Z (9 months ago)
- Topics: controlnet, diffusers, diffusion, diffusion-models, stable-diffusion
- Language: Jupyter Notebook
- Homepage:
- Size: 14.5 MB
- Stars: 23
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Installation
```bash
pip install diffusersplus
```
## Usage
To use the diffusersplus library, follow the steps below for different tasks:
### Stable Diffusion Text2Image Generate:
```python
from diffusersplus import diffusion_pipeline
model = diffusion_pipeline(
task_id="stable-txt2img",
stable_model_id="dreamlike-art/dreamlike-anime-1.0",
scheduler_name="DDIM"
)
output = model(
prompt="A photo of an anime character",
negative_prompt="bad",
num_images_per_prompt=1,
num_inference_steps=30,
guidance_scale=7.0,
guidance_rescale=0.0,
generator_seed=0,
height=512,
width=512,
)
```
### Stable Diffusion Image2Image Generate:
```python
from diffusersplus import diffusion_pipeline
model = diffusion_pipeline(
task_id="stable-img2img",
stable_model_id="dreamlike-art/dreamlike-anime-1.0",
scheduler_name="DDIM"
)
output = model(
image_path="../data/image.png",
prompt="A photo of a cat.",
negative_prompt="bad",
num_images_per_prompt=1,
num_inference_steps=50,
guidance_scale=7.0,
strength=0.5,
generator_seed=0,
resize_type="center_crop_and_resize",
crop_size=512,
height=512,
width=512,
)
```
### Stable Diffusion Upscale:
```python
from diffusersplus import diffusion_pipeline
model = diffusion_pipeline(
task_id="stable-upscale",
stable_model_id="stabilityai/stable-diffusion-x4-upscaler",
scheduler_name="DDIM"
)
output = model(
image_path="../data/image.png",
prompt="A photo of a anime character.",
negative_prompt="bad",
resize_type="center_crop_and_resize",
noise_level=20,
num_images_per_prompt=1,
num_inference_steps=20,
guidance_scale=7.0,
generator_seed=0,
)
```
### Controlnet:
```python
from diffusersplus import diffusion_pipeline
model = diffusion_pipeline(
task_id="controlnet",
stable_model_id="dreamlike-art/dreamlike-anime-1.0",
controlnet_model_id="lllyasviel/sd-controlnet-canny",
scheduler_name="DDIM",
)
output = model(
image_path="../data/image.png",
prompt="A photo of cat.",
negative_prompt="bad",
height=512,
width=512,
preprocess_type="Canny",
resize_type="center_crop_and_resize",
guess_mode=False,
num_images_per_prompt=1,
num_inference_steps=50,
guidance_scale=7.0,
controlnet_conditioning_scale=0.2,
generator_seed=0,
)
```
### Controlnet Inpaint:
```python
from diffusersplus import diffusion_pipeline
model = diffusion_pipeline(
task_id="controlnet-inpaint",
stable_model_id="dreamlike-art/dreamlike-anime-1.0",
controlnet_model_id="lllyasviel/sd-controlnet-canny",
scheduler_name="DDIM",
)
output = model(
image_path="../data/image.png",
mask_path="../data/mask_image.png",
prompt="A photo of a cat.",
negative_prompt="bad",
height=512,
width=512,
preprocess_type="Canny",
resize_type="center_crop_and_resize",
strength=0.5,
guess_mode=False,
num_images_per_prompt=1,
num_inference_steps=50,
guidance_scale=7.0,
controlnet_conditioning_scale=1.0,
generator_seed=0,
)
```
### Controlnet Image2Image:
```python
from diffusersplus import diffusion_pipeline
model = diffusion_pipeline(
task_id="controlnet-img2img",
stable_model_id="dreamlike-art/dreamlike-anime-1.0",
controlnet_model_id="lllyasviel/sd-controlnet-canny",
scheduler_name="DDIM",
)
output = model(
image_path="../data/image.png",
prompt="A photo of a cat.",
negative_prompt="bad",
height=512,
width=512,
preprocess_type="Canny",
resize_type="center_crop_and_resize",
guess_mode=False,
num_images_per_prompt=1,
num_inference_steps=20,
guidance_scale=7.0,
controlnet_conditioning_scale=1.0,
strength=0.5,
generator_seed=0,
)
```