ethe commited on
Commit
076542d
·
1 Parent(s): b316f59

update gradio mistake

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -12,12 +12,12 @@ pipe = StableDiffusionPipeline.from_single_file(
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,
@@ -32,17 +32,18 @@ def inference(prompt):
32
  ).images
33
  return image
34
 
35
-
36
- INPUT_HEIGHT = 512
37
- INPUT_WIDTH = 512
38
  with gr.Row():
39
  input_prompt = gr.Textbox(placeholder="输入你对室内设计的要求,以便 AI 能够更好地满足你的需求。", label="要求")
40
  with gr.Row():
41
- ref_image = gr.Image(label="参考图片").style(height=INPUT_HEIGHT, width=INPUT_WIDTH)
42
- result_image = gr.Gallery().style(columns=3,height=INPUT_HEIGHT, width=INPUT_WIDTH)
 
 
 
 
43
  demo = gr.Interface(
44
  fn=inference,
45
- inputs=[input_prompt],
46
  outputs=[result_image]
47
  )
48
 
 
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
  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,ref_image):
21
  image = pipe(
22
  prompt=prompt,
23
  negative_prompt=negative_prompt,
 
32
  ).images
33
  return image
34
 
 
 
 
35
  with gr.Row():
36
  input_prompt = gr.Textbox(placeholder="输入你对室内设计的要求,以便 AI 能够更好地满足你的需求。", label="要求")
37
  with gr.Row():
38
+ ref_image = gr.Image(height=512, width=512, label="参考图片")
39
+
40
+ result_image = gr.Gallery(label="可能满足你需求的室内设计图:",
41
+ columns=3,
42
+ height="auto",
43
+ object_fit="contain")
44
  demo = gr.Interface(
45
  fn=inference,
46
+ inputs=[input_prompt,ref_image],
47
  outputs=[result_image]
48
  )
49