sergon19's picture
Update app.py
8c26a19 verified
raw
history blame
671 Bytes
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.float32)
pipe = DiffusionPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-base-1.0",
vae=vae,
torch_dtype=torch.float32,
use_safetensors=True
)
pipe.load_lora_weights("sergon19/green_bg_LoRa10")
_ = pipe.to("cpu")
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()