from diffusers import StableDiffusionPipeline | |
import torch | |
import PIL | |
from IPython.display import display | |
# Load the base model | |
pipe = StableDiffusionPipeline.from_pretrained( | |
"runwayml/stable-diffusion-v1-5", # base model | |
torch_dtype=torch.float16, | |
).to("cuda") | |
# Load your LoRA | |
pipe.load_lora_weights("Flo444/example-lora-realistic") | |
# Fuse LoRA (optional: set strength 0.7 or whatever you want) | |
pipe.fuse_lora(lora_scale=0.7) | |
# Prompt | |
prompt = "beautiful realistic landscape, mountains, river" | |
# Generate | |
image = pipe(prompt, num_inference_steps=30, guidance_scale=7).images[0] | |
# Display the image directly in Colab | |
display(image) |