SkalskiP commited on
Commit
1dcf1d9
1 Parent(s): d2b30ac

try new `resize_image_dimensions`

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -17,7 +17,7 @@ for taking it to the next level by enabling inpainting with the FLUX.
17
  """
18
 
19
  MAX_SEED = np.iinfo(np.int32).max
20
- MAX_IMAGE_SIZE = 2048
21
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
22
 
23
  pipe = FluxInpaintPipeline.from_pretrained(
@@ -26,14 +26,14 @@ pipe = FluxInpaintPipeline.from_pretrained(
26
 
27
  def resize_image_dimensions(
28
  original_resolution_wh: Tuple[int, int],
29
- maximum_dimension: int = 2048
30
  ) -> Tuple[int, int]:
31
  width, height = original_resolution_wh
32
 
33
- if width <= maximum_dimension and height <= maximum_dimension:
34
- width = width - (width % 32)
35
- height = height - (height % 32)
36
- return width, height
37
 
38
  if width > height:
39
  scaling_factor = maximum_dimension / width
@@ -128,19 +128,24 @@ with gr.Blocks() as demo:
128
  )
129
 
130
  randomize_seed_checkbox_component = gr.Checkbox(
131
- label="Randomize seed", value=False)
132
 
133
  with gr.Row():
134
  strength_slider_component = gr.Slider(
135
  label="Strength",
 
 
 
136
  minimum=0,
137
  maximum=1,
138
  step=0.01,
139
- value=0.75,
140
  )
141
 
142
  num_inference_steps_slider_component = gr.Slider(
143
  label="Number of inference steps",
 
 
144
  minimum=1,
145
  maximum=50,
146
  step=1,
 
17
  """
18
 
19
  MAX_SEED = np.iinfo(np.int32).max
20
+ IMAGE_SIZE = 1024
21
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
22
 
23
  pipe = FluxInpaintPipeline.from_pretrained(
 
26
 
27
  def resize_image_dimensions(
28
  original_resolution_wh: Tuple[int, int],
29
+ maximum_dimension: int = IMAGE_SIZE
30
  ) -> Tuple[int, int]:
31
  width, height = original_resolution_wh
32
 
33
+ # if width <= maximum_dimension and height <= maximum_dimension:
34
+ # width = width - (width % 32)
35
+ # height = height - (height % 32)
36
+ # return width, height
37
 
38
  if width > height:
39
  scaling_factor = maximum_dimension / width
 
128
  )
129
 
130
  randomize_seed_checkbox_component = gr.Checkbox(
131
+ label="Randomize seed", value=True)
132
 
133
  with gr.Row():
134
  strength_slider_component = gr.Slider(
135
  label="Strength",
136
+ info="Indicates extent to transform the reference `image`. "
137
+ "Must be between 0 and 1. `image` is used as a starting "
138
+ "point and more noise is added the higher the `strength`.",
139
  minimum=0,
140
  maximum=1,
141
  step=0.01,
142
+ value=0.85,
143
  )
144
 
145
  num_inference_steps_slider_component = gr.Slider(
146
  label="Number of inference steps",
147
+ info="The number of denoising steps. More denoising steps "
148
+ "usually lead to a higher quality image at the",
149
  minimum=1,
150
  maximum=50,
151
  step=1,