Update README.md
Browse files
README.md
CHANGED
|
@@ -31,23 +31,24 @@ A LoRA fine-tuned [Stable Diffusion XL (SDXL)](https://huggingface.co/stabilitya
|
|
| 31 |
## 📦 How to Use
|
| 32 |
|
| 33 |
```python
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
| 35 |
import torch
|
| 36 |
|
| 37 |
# Load base SDXL model
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
torch_dtype=torch.float16,
|
| 41 |
-
use_safetensors=True,
|
| 42 |
-
).to("cuda")
|
| 43 |
|
| 44 |
# Load LoRA weights
|
| 45 |
-
|
| 46 |
|
| 47 |
# Enable LoRA
|
| 48 |
-
|
| 49 |
|
| 50 |
# Generate a UI screen
|
| 51 |
prompt = "A mobile UI showing a hotel reservation screen with elegant typography and clean layout"
|
| 52 |
-
image =
|
| 53 |
-
image.save("output.png")
|
|
|
|
|
|
| 31 |
## 📦 How to Use
|
| 32 |
|
| 33 |
```python
|
| 34 |
+
pip install diffusers
|
| 35 |
+
|
| 36 |
+
```python
|
| 37 |
+
from diffusers import DiffusionPipeline
|
| 38 |
import torch
|
| 39 |
|
| 40 |
# Load base SDXL model
|
| 41 |
+
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, use_safetensors=True, variant="fp16")
|
| 42 |
+
pipe.to("cuda")
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
# Load LoRA weights
|
| 45 |
+
pipe.load_lora_weights("aryanbaghel/ui-generator-prototype")
|
| 46 |
|
| 47 |
# Enable LoRA
|
| 48 |
+
pipe.fuse_lora()
|
| 49 |
|
| 50 |
# Generate a UI screen
|
| 51 |
prompt = "A mobile UI showing a hotel reservation screen with elegant typography and clean layout"
|
| 52 |
+
image = pipe(prompt=prompt).images[0]
|
| 53 |
+
image.save("output.png")
|
| 54 |
+
print("SUCCESS!")
|