zhengchong commited on
Commit
7f24de3
·
1 Parent(s): 0ed20b9

refactor: Remove resolution parameters and update guidance scale in app.py

Browse files

- Eliminated the resolution parameter from the submit_function_flux, simplifying the function signature.
- Adjusted the guidance scale slider's maximum value from 7.5 to 50, enhancing user control over the model's behavior.
- Updated the UI layout for result image display, ensuring consistency in the application interface.

Files changed (1) hide show
  1. app.py +2 -11
app.py CHANGED
@@ -287,17 +287,11 @@ def submit_function_flux(
287
  person_image,
288
  cloth_image,
289
  cloth_type,
290
- resolution,
291
  num_inference_steps,
292
  guidance_scale,
293
  seed,
294
  show_type
295
  ):
296
- # Set height and width based on resolution
297
- height = resolution
298
- width = int(height * 0.75)
299
- args.width = width
300
- args.height = height
301
 
302
  # Process image editor input
303
  person_image, mask = person_image["background"], person_image["layers"][0]
@@ -573,7 +567,7 @@ def app_gradio():
573
  )
574
  # Guidence Scale
575
  guidance_scale_flux = gr.Slider(
576
- label="CFG Strenth", minimum=0.0, maximum=7.5, step=0.5, value=2.5
577
  )
578
  # Random Seed
579
  seed_flux = gr.Slider(
@@ -584,12 +578,9 @@ def app_gradio():
584
  choices=["result only", "input & result", "input & mask & result"],
585
  value="input & mask & result",
586
  )
587
-
588
- with gr.Column(scale=2, min_width=500):
589
- result_image_flux = gr.Image(interactive=False, label="Result")
590
 
591
  with gr.Column(scale=2, min_width=500):
592
- result_image_p2p = gr.Image(interactive=False, label="Result")
593
  with gr.Row():
594
  # Photo Examples
595
  root_path = "resource/demo/example"
 
287
  person_image,
288
  cloth_image,
289
  cloth_type,
 
290
  num_inference_steps,
291
  guidance_scale,
292
  seed,
293
  show_type
294
  ):
 
 
 
 
 
295
 
296
  # Process image editor input
297
  person_image, mask = person_image["background"], person_image["layers"][0]
 
567
  )
568
  # Guidence Scale
569
  guidance_scale_flux = gr.Slider(
570
+ label="CFG Strenth", minimum=0.0, maximum=50, step=0.5, value=30
571
  )
572
  # Random Seed
573
  seed_flux = gr.Slider(
 
578
  choices=["result only", "input & result", "input & mask & result"],
579
  value="input & mask & result",
580
  )
 
 
 
581
 
582
  with gr.Column(scale=2, min_width=500):
583
+ result_image_flux = gr.Image(interactive=False, label="Result")
584
  with gr.Row():
585
  # Photo Examples
586
  root_path = "resource/demo/example"