zhiweili commited on
Commit
ee01755
1 Parent(s): 2a183bf

add segment_size

Browse files
Files changed (1) hide show
  1. app_base.py +5 -3
app_base.py CHANGED
@@ -30,6 +30,7 @@ def create_demo() -> gr.Blocks:
30
  num_steps: int,
31
  start_step: int,
32
  guidance_scale: float,
 
33
  generate_size: int,
34
  upscale_prompt: str,
35
  upscale_start_size: int = 256,
@@ -72,7 +73,7 @@ def create_demo() -> gr.Blocks:
72
  upscale_steps=upscale_steps,
73
  )
74
  run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)
75
- enhanced_image = enhanced_image.resize((generate_size, generate_size))
76
 
77
  return enhanced_image, res_image, time_cost_str
78
 
@@ -106,6 +107,7 @@ def create_demo() -> gr.Blocks:
106
  start_step = gr.Slider(minimum=1, maximum=100, value=30, step=1, label="Start Step")
107
  with gr.Accordion("Advanced Options", open=False):
108
  guidance_scale = gr.Slider(minimum=0, maximum=20, value=0, step=0.5, label="Guidance Scale")
 
109
  generate_size = gr.Number(label="Generate Size", value=256)
110
  mask_expansion = gr.Number(label="Mask Expansion", value=50, visible=True)
111
  mask_dilation = gr.Slider(minimum=0, maximum=10, value=2, step=1, label="Mask Dilation")
@@ -128,12 +130,12 @@ def create_demo() -> gr.Blocks:
128
 
129
  g_btn.click(
130
  fn=segment_image,
131
- inputs=[input_image, category, generate_size, mask_expansion, mask_dilation],
132
  outputs=[origin_area_image, croper],
133
  ).success(
134
  fn=image_to_image,
135
  inputs=[origin_area_image, input_image_prompt, edit_prompt,seed,w1, num_steps, start_step,
136
- guidance_scale, generate_size, upscale_prompt, upscale_start_size, upscale_steps,
137
  pre_upscale, pre_upscale_start_size, pre_upscale_steps],
138
  outputs=[enhanced_image, generated_image, generated_cost],
139
  ).success(
 
30
  num_steps: int,
31
  start_step: int,
32
  guidance_scale: float,
33
+ segment_size: int,
34
  generate_size: int,
35
  upscale_prompt: str,
36
  upscale_start_size: int = 256,
 
73
  upscale_steps=upscale_steps,
74
  )
75
  run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)
76
+ enhanced_image = enhanced_image.resize((segment_size, segment_size))
77
 
78
  return enhanced_image, res_image, time_cost_str
79
 
 
107
  start_step = gr.Slider(minimum=1, maximum=100, value=30, step=1, label="Start Step")
108
  with gr.Accordion("Advanced Options", open=False):
109
  guidance_scale = gr.Slider(minimum=0, maximum=20, value=0, step=0.5, label="Guidance Scale")
110
+ segment_size = gr.Number(label="Segment Size", value=1024)
111
  generate_size = gr.Number(label="Generate Size", value=256)
112
  mask_expansion = gr.Number(label="Mask Expansion", value=50, visible=True)
113
  mask_dilation = gr.Slider(minimum=0, maximum=10, value=2, step=1, label="Mask Dilation")
 
130
 
131
  g_btn.click(
132
  fn=segment_image,
133
+ inputs=[input_image, category, segment_size, mask_expansion, mask_dilation],
134
  outputs=[origin_area_image, croper],
135
  ).success(
136
  fn=image_to_image,
137
  inputs=[origin_area_image, input_image_prompt, edit_prompt,seed,w1, num_steps, start_step,
138
+ guidance_scale, segment_size, generate_size, upscale_prompt, upscale_start_size, upscale_steps,
139
  pre_upscale, pre_upscale_start_size, pre_upscale_steps],
140
  outputs=[enhanced_image, generated_image, generated_cost],
141
  ).success(