Spaces:
Runtime error
Runtime error
second commit use stablepipeline from a single file
Browse files
app.py
CHANGED
@@ -1,7 +1,41 @@
|
|
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
def
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
iface.launch()
|
|
|
1 |
+
|
2 |
import gradio as gr
|
3 |
+
import torch
|
4 |
+
from diffusers import AutoencoderKL, StableDiffusionXLPipeline,StableDiffusionPipeline
|
5 |
+
|
6 |
+
pipe = StableDiffusionPipeline.from_single_file(
|
7 |
+
"https://huggingface.co/ethe/Architecture_model/blob/main/architectureExterior_v40Exterior.safetensors",
|
8 |
+
# "/mnt/pfs-guan-ssai/cv/panxuhao/checkpoints/stable-diffusion-xl-base-1.0/sd_xl_base_1.0.safetensors",
|
9 |
+
torch_dtype=torch.float16,
|
10 |
+
local_files_only=True,
|
11 |
+
variant="fp16",
|
12 |
+
use_safetensors=True,
|
13 |
+
)
|
14 |
+
|
15 |
+
num_images_per_prompt = 4
|
16 |
+
prompt = 'Modern Elegance:Explore the seamless blend of sleek lines, minimalist aesthetics, and cutting-edge design in modern interior decor'
|
17 |
|
18 |
+
def inference():
|
19 |
+
image = pipe(
|
20 |
+
prompt=prompt,
|
21 |
+
negative_prompt="watermark, logo, symbol, word, phrase, human, noisy, blurry, deformed, ugly, NSFW, low quality, worst quality, monochrome, illustration, sketch, grayscale, backlight, messy, blurry",
|
22 |
+
num_inference_steps=30,
|
23 |
+
# cross_attention_kwargs={"scale": lora_scale},
|
24 |
+
generator=torch.manual_seed(0),
|
25 |
+
width=768,
|
26 |
+
height=768,
|
27 |
+
guidance_scale=7.0,
|
28 |
+
use_karras_sigmas=True,
|
29 |
+
num_images_per_prompt=num_images_per_prompt, # 如果是 4, image 就是四张图片组成的 List
|
30 |
+
).images
|
31 |
+
return image
|
32 |
+
demo = gr.Interface(
|
33 |
+
fn=inference,
|
34 |
+
inputs=None,
|
35 |
+
outputs=gr.Gallery(label="可能满足你需求的室内设计图:",
|
36 |
+
columns=3,
|
37 |
+
height="auto",
|
38 |
+
object_fit="contain")
|
39 |
+
)
|
40 |
|
41 |
+
demo.launch()
|
|