Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from diffusers import DiffusionPipeline
|
3 |
+
import torch
|
4 |
+
|
5 |
+
# Gradio demo function for greeting
|
6 |
+
def greet(name):
|
7 |
+
return "Hello " + name + "!!"
|
8 |
+
|
9 |
+
# Set up the Gradio interface
|
10 |
+
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
11 |
+
demo.launch(share=True)
|
12 |
+
|
13 |
+
# Load the Stable Diffusion pipeline
|
14 |
+
pipeline = DiffusionPipeline.from_pretrained(
|
15 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
16 |
+
torch_dtype=torch.float16
|
17 |
+
).to("cuda")
|
18 |
+
|
19 |
+
# Load the LoRA weights
|
20 |
+
pipeline.load_lora_weights(
|
21 |
+
"ostris/ikea-instructions-lora-sdxl",
|
22 |
+
weight_name="ikea_instructions_xl_v1_5.safetensors",
|
23 |
+
adapter_name="ikea"
|
24 |
+
)
|
25 |
+
pipeline.load_lora_weights(
|
26 |
+
"lordjia/by-feng-zikai",
|
27 |
+
weight_name="fengzikai_v1.0_XL.safetensors",
|
28 |
+
adapter_name="feng"
|
29 |
+
)
|