Update README.md
Browse files
README.md
CHANGED
|
@@ -55,11 +55,29 @@ More for DreamBooth model, please refer to https://dreambooth.github.io/.
|
|
| 55 |
## Usage
|
| 56 |
|
| 57 |
```python
|
|
|
|
|
|
|
|
|
|
| 58 |
from diffusers import StableDiffusionPipeline
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
```
|
| 64 |
|
| 65 |
## Fine Tune Source Code
|
|
|
|
| 55 |
## Usage
|
| 56 |
|
| 57 |
```python
|
| 58 |
+
pip install -qqU diffusers accelerate
|
| 59 |
+
|
| 60 |
+
import torch
|
| 61 |
from diffusers import StableDiffusionPipeline
|
| 62 |
|
| 63 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id)
|
| 64 |
+
|
| 65 |
+
# set prompt
|
| 66 |
+
prompt = "a photo of cyberboard keyboard" #@param
|
| 67 |
+
guidance_scale=12 #@param {type:"integer"}
|
| 68 |
+
num_inference_steps = 50 #@param {type:"integer"}
|
| 69 |
+
|
| 70 |
+
# Run the pipeline, showing some of the available arguments
|
| 71 |
+
pipe_output = pipe(
|
| 72 |
+
prompt=prompt, # What to generate
|
| 73 |
+
negative_prompt="Oversaturated, blurry, low quality", # What NOT to generate
|
| 74 |
+
height=480, width=640, # Specify the image size
|
| 75 |
+
guidance_scale=guidance_scale, # How strongly to follow the prompt
|
| 76 |
+
num_inference_steps=num_inference_steps, # How many steps to take
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
# View the resulting image
|
| 80 |
+
pipe_output.images[0]
|
| 81 |
```
|
| 82 |
|
| 83 |
## Fine Tune Source Code
|