import gradio as gr #gr.load("models/sergon19/green_bg_LoRa10").launch() import torch from diffusers import DiffusionPipeline, AutoencoderKL vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16) pipe = DiffusionPipeline.from_pretrained( "stabilityai/stable-diffusion-xl-base-1.0", vae=vae, torch_dtype=torch.float16, variant="fp16", use_safetensors=True ) pipe.load_lora_weights("sergon19/green_bg_LoRa10") _ = pipe.to("cuda") def generate_image(prompt): image = pipe(prompt=prompt, num_inference_steps=25).images[0] return image iface = gr.Interface(fn=generate_image, inputs="text", outputs="image") iface.launch()