Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,24 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
gr.load("models/sergon19/green_bg_LoRa10").launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
#gr.load("models/sergon19/green_bg_LoRa10").launch()
|
4 |
+
|
5 |
+
import torch
|
6 |
+
from diffusers import DiffusionPipeline, AutoencoderKL
|
7 |
+
|
8 |
+
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
9 |
+
pipe = DiffusionPipeline.from_pretrained(
|
10 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
11 |
+
vae=vae,
|
12 |
+
torch_dtype=torch.float16,
|
13 |
+
variant="fp16",
|
14 |
+
use_safetensors=True
|
15 |
+
)
|
16 |
+
pipe.load_lora_weights("sergon19/green_bg_LoRa10")
|
17 |
+
_ = pipe.to("cuda")
|
18 |
+
|
19 |
+
def generate_image(prompt):
|
20 |
+
image = pipe(prompt=prompt, num_inference_steps=25).images[0]
|
21 |
+
return image
|
22 |
+
|
23 |
+
iface = gr.Interface(fn=generate_image, inputs="text", outputs="image")
|
24 |
+
iface.launch()
|