update
Browse files
README.md
CHANGED
@@ -42,12 +42,30 @@ To use this model for generating images from text prompts, follow these steps:
|
|
42 |
pip install -r requirements.txt
|
43 |
```
|
44 |
|
45 |
-
3
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
4. **Generated Images:**
|
53 |
The generated images will be saved in the `output_images` directory by default.
|
|
|
42 |
pip install -r requirements.txt
|
43 |
```
|
44 |
|
45 |
+
3.## Usage
|
46 |
+
|
47 |
+
Here is an example of how you can use the `stabilityai/stable-diffusion-xl-base-1.0` model for text-to-image generation in Python using the `diffusers` library.
|
48 |
+
|
49 |
+
```python
|
50 |
+
from diffusers import DiffusionPipeline
|
51 |
+
import torch
|
52 |
+
|
53 |
+
# Load LoRA weights
|
54 |
+
lora_weights = torch.load("/path/to/lora_weights/pytorch_lora_weights.safetensors")
|
55 |
+
|
56 |
+
# Initialize the DiffusionPipeline
|
57 |
+
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16)
|
58 |
+
pipe.to("cuda")
|
59 |
+
|
60 |
+
# Load LoRA weights into the pipeline
|
61 |
+
pipe.load_lora_weights(lora_weights)
|
62 |
+
|
63 |
+
# Text prompt for image generation
|
64 |
+
prompt = "photo of Iyad Radi with cat in the pool"
|
65 |
+
|
66 |
+
# Generate Images
|
67 |
+
image = pipe(prompt, num_inference_steps=30, guidance_scale=7.5).images
|
68 |
+
|
69 |
|
70 |
4. **Generated Images:**
|
71 |
The generated images will be saved in the `output_images` directory by default.
|