Spaces:
Runtime error
Runtime error
File size: 695 Bytes
d8e07ba e77b808 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import torch
from diffusers import LCMScheduler, AutoPipelineForText2Image
import streamlit as st
model_id = "stabilityai/stable-diffusion-xl-base-1.0"
adapter_id = "latent-consistency/lcm-lora-sdxl"
pipe = AutoPipelineForText2Image.from_pretrained(model_id, torch_dtype=torch.float32, variant="fp16")
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
#pipe.to("cuda")
# load and fuse lcm lora
pipe.load_lora_weights(adapter_id)
pipe.fuse_lora()
prompt = st.text_input(str("Insert here you prompt?"))
# disable guidance_scale by passing 0
image = pipe(prompt=prompt, num_inference_steps=4, guidance_scale=0).images[0]
st.image(image,f"Image generated by your prompt {prompt}") |