Spaces:
Runtime error
Runtime error
modify app input and output
Browse files
app.py
CHANGED
|
@@ -12,30 +12,36 @@ pipe = StableDiffusionPipeline.from_single_file(
|
|
| 12 |
use_safetensors=True,
|
| 13 |
)
|
| 14 |
|
| 15 |
-
num_images_per_prompt =
|
| 16 |
prompt = 'Modern Elegance:Explore the seamless blend of sleek lines, minimalist aesthetics, and cutting-edge design in modern interior decor'
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
| 19 |
image = pipe(
|
| 20 |
prompt=prompt,
|
| 21 |
-
negative_prompt=
|
| 22 |
-
num_inference_steps=
|
| 23 |
# cross_attention_kwargs={"scale": lora_scale},
|
| 24 |
generator=torch.manual_seed(0),
|
| 25 |
-
width=
|
| 26 |
-
height=
|
| 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 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
columns=3,
|
| 37 |
height="auto",
|
| 38 |
object_fit="contain")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
)
|
| 40 |
|
| 41 |
demo.launch()
|
|
|
|
| 12 |
use_safetensors=True,
|
| 13 |
)
|
| 14 |
|
| 15 |
+
num_images_per_prompt = 2
|
| 16 |
prompt = 'Modern Elegance:Explore the seamless blend of sleek lines, minimalist aesthetics, and cutting-edge design in modern interior decor'
|
| 17 |
|
| 18 |
+
negative_prompt = '(nsfw:1.3),(Nude:1.3),(Naked:1.3),low quality, blurry, bad anatomy, worst quality, text, watermark, normal quality, ugly, signature, lowres, deformed, disfigured, cropped, jpeg artifacts, error, \
|
| 19 |
+
mutation, logo, watermark,text, logo,contact, error, blurry, cropped, username, artist name, (worst quality, low quality:1.4),monochrome,'
|
| 20 |
+
def inference(prompt):
|
| 21 |
image = pipe(
|
| 22 |
prompt=prompt,
|
| 23 |
+
negative_prompt=negative_prompt,
|
| 24 |
+
num_inference_steps=20,
|
| 25 |
# cross_attention_kwargs={"scale": lora_scale},
|
| 26 |
generator=torch.manual_seed(0),
|
| 27 |
+
width=512,
|
| 28 |
+
height=512,
|
| 29 |
guidance_scale=7.0,
|
| 30 |
use_karras_sigmas=True,
|
| 31 |
num_images_per_prompt=num_images_per_prompt, # 如果是 4, image 就是四张图片组成的 List
|
| 32 |
).images
|
| 33 |
return image
|
| 34 |
+
|
| 35 |
+
ref_image = gr.Image(height=512, width=512, label="参考图片")
|
| 36 |
+
prompt = gr.Textbox(placeholder="输入你对室内设计的要求,以便 AI 能够更好地满足你的需求。", label="要求")
|
| 37 |
+
result_image = gr.Gallery(label="可能满足你需求的室内设计图:",
|
| 38 |
columns=3,
|
| 39 |
height="auto",
|
| 40 |
object_fit="contain")
|
| 41 |
+
demo = gr.Interface(
|
| 42 |
+
fn=inference,
|
| 43 |
+
inputs=prompt,
|
| 44 |
+
outputs=result_image
|
| 45 |
)
|
| 46 |
|
| 47 |
demo.launch()
|