NikhilJoson commited on
Commit
bf4215a
·
verified ·
1 Parent(s): 0f83a92

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -57,10 +57,10 @@ def generate_image(category, img1, img2, img3, height, width, img_guidance_scale
57
  wears = predict_clothing(input_images[1:])
58
  if len(wears)==1:
59
  dress = wears[0]
60
- text = f"""The {category} in <img><|image_1|></img> wearing {dress} in <img><|image_2|></img>."""
61
  elif len(wears)==2:
62
  topwear, bottomwear = wears[0], wears[1]
63
- text = f"""The {category} in <img><|image_1|></img> wearing {topwear} in <img><|image_2|></img> and {bottomwear} in <img><|image_3|></img>."""
64
  else:
65
  input_images = None
66
 
@@ -94,7 +94,7 @@ def get_example():
94
  ]
95
  return case
96
 
97
- def run_for_examples(img1, img2, img3, height, width, img_guidance_scale, seed, max_input_image_size, randomize_seed, use_input_image_size_as_output,):
98
  # Check the internal configuration of the function
99
  inference_steps = 50
100
  separate_cfg_infer = True
@@ -102,7 +102,7 @@ def run_for_examples(img1, img2, img3, height, width, img_guidance_scale, seed,
102
 
103
  text = "According to the following examples, generate an output for the input.\nInput: <img><|image_1|></img>\nOutput: <img><|image_2|></img>\n\nInput: <img><|image_3|></img>\nOutput:"
104
  return generate_image(img1, img2, img3, height, width, img_guidance_scale, inference_steps, seed, separate_cfg_infer,
105
- offload_model, use_input_image_size_as_output, max_input_image_size, randomize_seed)
106
 
107
 
108
  description = """
@@ -143,8 +143,6 @@ with gr.Blocks() as demo:
143
  height_input = gr.Slider(label="Height", minimum=128, maximum=1024, value=512, step=16)
144
  width_input = gr.Slider(label="Width", minimum=128, maximum=1024, value=512, step=16)
145
 
146
- # guidance_scale_input = gr.Slider(label="Guidance Scale", minimum=1.0, maximum=5.0, value=2.5, step=0.1)
147
-
148
  num_inference_steps = gr.Slider(label="Inference Steps", minimum=1, maximum=128, value=32, step=1)
149
 
150
  seed_input = gr.Slider(label="Seed", minimum=0, maximum=2147483647, value=42, step=1)
@@ -152,6 +150,8 @@ with gr.Blocks() as demo:
152
 
153
  with gr.Column():
154
  max_input_image_size = gr.Slider(label="max_input_image_size", minimum=128, maximum=2048, value=1024, step=16)
 
 
155
 
156
  img_guidance_scale_input = gr.Slider(label="img_guidance_scale", minimum=1.0, maximum=2.0, value=1.6, step=0.1)
157
 
@@ -176,7 +176,7 @@ with gr.Blocks() as demo:
176
  generate_button.click(
177
  generate_image,
178
  inputs=[category, image_input_1, image_input_2, image_input_3, height_input, width_input, img_guidance_scale_input, num_inference_steps,
179
- seed_input, separate_cfg_infer, offload_model, use_input_image_size_as_output, max_input_image_size, randomize_seed,],
180
  outputs=output_image,
181
  )
182
 
@@ -184,7 +184,7 @@ with gr.Blocks() as demo:
184
  examples=get_example(),
185
  fn=run_for_examples,
186
  inputs=[image_input_1, image_input_2, image_input_3, height_input, width_input, img_guidance_scale_input, seed_input,
187
- max_input_image_size, randomize_seed, use_input_image_size_as_output],
188
  outputs=output_image,
189
  )
190
 
 
57
  wears = predict_clothing(input_images[1:])
58
  if len(wears)==1:
59
  dress = wears[0]
60
+ text = f"""A {category} wearing {dress}, with a completely white background. The {category} is <img><|image_1|></img>. The {dress} is in <img><|image_2|></img>."""
61
  elif len(wears)==2:
62
  topwear, bottomwear = wears[0], wears[1]
63
+ text = f"""A {category} wearing {topwear} and {bottomwear}, with a completely white background. The {category} is <img><|image_1|></img>. The {topwear} is in <img><|image_2|></img>. The {bottomwear} is in <img><|image_3|></img>.""
64
  else:
65
  input_images = None
66
 
 
94
  ]
95
  return case
96
 
97
+ def run_for_examples(img1, img2, img3, height, width, img_guidance_scale, seed, max_input_image_size, randomize_seed, use_input_image_size_as_output,guidance_scale):
98
  # Check the internal configuration of the function
99
  inference_steps = 50
100
  separate_cfg_infer = True
 
102
 
103
  text = "According to the following examples, generate an output for the input.\nInput: <img><|image_1|></img>\nOutput: <img><|image_2|></img>\n\nInput: <img><|image_3|></img>\nOutput:"
104
  return generate_image(img1, img2, img3, height, width, img_guidance_scale, inference_steps, seed, separate_cfg_infer,
105
+ offload_model, use_input_image_size_as_output, max_input_image_size, randomize_seed, guidance_scale)
106
 
107
 
108
  description = """
 
143
  height_input = gr.Slider(label="Height", minimum=128, maximum=1024, value=512, step=16)
144
  width_input = gr.Slider(label="Width", minimum=128, maximum=1024, value=512, step=16)
145
 
 
 
146
  num_inference_steps = gr.Slider(label="Inference Steps", minimum=1, maximum=128, value=32, step=1)
147
 
148
  seed_input = gr.Slider(label="Seed", minimum=0, maximum=2147483647, value=42, step=1)
 
150
 
151
  with gr.Column():
152
  max_input_image_size = gr.Slider(label="max_input_image_size", minimum=128, maximum=2048, value=1024, step=16)
153
+
154
+ guidance_scale_input = gr.Slider(label="Guidance Scale", minimum=1.0, maximum=5.0, value=2.5, step=0.1)
155
 
156
  img_guidance_scale_input = gr.Slider(label="img_guidance_scale", minimum=1.0, maximum=2.0, value=1.6, step=0.1)
157
 
 
176
  generate_button.click(
177
  generate_image,
178
  inputs=[category, image_input_1, image_input_2, image_input_3, height_input, width_input, img_guidance_scale_input, num_inference_steps,
179
+ seed_input, separate_cfg_infer, offload_model, use_input_image_size_as_output, max_input_image_size, randomize_seed, guidance_scale_input],
180
  outputs=output_image,
181
  )
182
 
 
184
  examples=get_example(),
185
  fn=run_for_examples,
186
  inputs=[image_input_1, image_input_2, image_input_3, height_input, width_input, img_guidance_scale_input, seed_input,
187
+ max_input_image_size, randomize_seed, use_input_image_size_as_output, guidance_scale_input],
188
  outputs=output_image,
189
  )
190