ZhouZJ36DL commited on
Commit
df97e04
·
1 Parent(s): eb71c0e

modified: app.py

Browse files
app.py CHANGED
@@ -463,7 +463,7 @@ def on_upload(path, uploaded: gr.EventData):
463
 
464
  def on_change(init_image, changed: gr.EventData):
465
  img_path = list(changed.target.temp_files)
466
- return gr.Gallery(value=[(img_path[0], "")], label="History Image", interactive=True, columns=3)
467
 
468
  def create_demo(model_name: str, device: str = "cuda" if torch.cuda.is_available() else "cpu", offload: bool = False):
469
  editor = FluxEditor(args)
@@ -505,10 +505,11 @@ def create_demo(model_name: str, device: str = "cuda" if torch.cuda.is_available
505
  inject_step = gr.Slider(0, 15, 1, step=1, label="Number of inject steps")
506
  output_image = gr.Image(label="Generated/Edited Image")
507
  reset_btn = gr.Button("Reset")
 
508
 
509
  gallery.select(on_select, gallery, [init_image, source_prompt])
510
  gallery.upload(on_upload, gallery, init_image)
511
- init_image.change(on_change, init_image, gallery)
512
 
513
  generate_btn.click(
514
  fn=editor.process_image,
@@ -521,7 +522,7 @@ def create_demo(model_name: str, device: str = "cuda" if torch.cuda.is_available
521
  gr.Examples(
522
  examples=examples,
523
  inputs=[
524
- init_image,
525
  source_prompt,
526
  target_prompt,
527
  editing_strategy,
 
463
 
464
  def on_change(init_image, changed: gr.EventData):
465
  img_path = list(changed.target.temp_files)
466
+ return gr.Gallery(value=[(img_path[0], "")], label="History Image", interactive=True, columns=3), img_path[0]
467
 
468
  def create_demo(model_name: str, device: str = "cuda" if torch.cuda.is_available() else "cpu", offload: bool = False):
469
  editor = FluxEditor(args)
 
505
  inject_step = gr.Slider(0, 15, 1, step=1, label="Number of inject steps")
506
  output_image = gr.Image(label="Generated/Edited Image")
507
  reset_btn = gr.Button("Reset")
508
+ example_image = gr.Image(label="example Image", visible=False, width=200)
509
 
510
  gallery.select(on_select, gallery, [init_image, source_prompt])
511
  gallery.upload(on_upload, gallery, init_image)
512
+ example_image.change(on_change, example_image, [gallery, init_image])
513
 
514
  generate_btn.click(
515
  fn=editor.process_image,
 
522
  gr.Examples(
523
  examples=examples,
524
  inputs=[
525
+ example_image,
526
  source_prompt,
527
  target_prompt,
528
  editing_strategy,
src/flux/__pycache__/__init__.cpython-310.pyc CHANGED
Binary files a/src/flux/__pycache__/__init__.cpython-310.pyc and b/src/flux/__pycache__/__init__.cpython-310.pyc differ
 
src/flux/__pycache__/_version.cpython-310.pyc CHANGED
Binary files a/src/flux/__pycache__/_version.cpython-310.pyc and b/src/flux/__pycache__/_version.cpython-310.pyc differ
 
src/flux/__pycache__/math.cpython-310.pyc CHANGED
Binary files a/src/flux/__pycache__/math.cpython-310.pyc and b/src/flux/__pycache__/math.cpython-310.pyc differ
 
src/flux/__pycache__/model.cpython-310.pyc CHANGED
Binary files a/src/flux/__pycache__/model.cpython-310.pyc and b/src/flux/__pycache__/model.cpython-310.pyc differ
 
src/flux/__pycache__/sampling.cpython-310.pyc CHANGED
Binary files a/src/flux/__pycache__/sampling.cpython-310.pyc and b/src/flux/__pycache__/sampling.cpython-310.pyc differ
 
src/flux/__pycache__/util.cpython-310.pyc CHANGED
Binary files a/src/flux/__pycache__/util.cpython-310.pyc and b/src/flux/__pycache__/util.cpython-310.pyc differ
 
src/flux/modules/__pycache__/autoencoder.cpython-310.pyc CHANGED
Binary files a/src/flux/modules/__pycache__/autoencoder.cpython-310.pyc and b/src/flux/modules/__pycache__/autoencoder.cpython-310.pyc differ
 
src/flux/modules/__pycache__/conditioner.cpython-310.pyc CHANGED
Binary files a/src/flux/modules/__pycache__/conditioner.cpython-310.pyc and b/src/flux/modules/__pycache__/conditioner.cpython-310.pyc differ
 
src/flux/modules/__pycache__/layers.cpython-310.pyc CHANGED
Binary files a/src/flux/modules/__pycache__/layers.cpython-310.pyc and b/src/flux/modules/__pycache__/layers.cpython-310.pyc differ