Xsong123 commited on
Commit
9ffb23b
·
verified ·
1 Parent(s): ff12ba7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -11
app.py CHANGED
@@ -114,12 +114,12 @@ def infer_with_lora(input_image, prompt, selected_index, seed=0, guidance_scale=
114
  ).images[0]
115
 
116
  # The seed value is no longer returned, as it's not being changed.
117
- return image, gr.update(visible=True), lora_scale
118
 
119
  except Exception as e:
120
  print(f"Error during inference: {e}")
121
  # Return an error state for all outputs
122
- return None, gr.update(visible=False), lora_scale
123
 
124
  # CSS styling
125
  css = """
@@ -218,8 +218,7 @@ with gr.Blocks(css=css, theme=gr.themes.Ocean(font=[gr.themes.GoogleFont("Lexend
218
  )
219
  run_button = gr.Button("Generate", elem_id="run_button")
220
 
221
- result = gr.Image(label="Generated Image", interactive=False)
222
- reuse_button = gr.Button("Reuse this image", visible=False)
223
 
224
  with gr.Accordion("Advanced Settings", open=False):
225
  lora_scale = gr.Slider(
@@ -273,13 +272,7 @@ with gr.Blocks(css=css, theme=gr.themes.Ocean(font=[gr.themes.GoogleFont("Lexend
273
  triggers=[run_button.click, prompt.submit],
274
  fn=infer_with_lora_wrapper,
275
  inputs=[input_image, prompt, selected_state, lora_state, custom_loaded_lora, seed, guidance_scale, num_inference_steps, lora_scale, gr_flux_loras],
276
- outputs=[result, reuse_button, lora_state]
277
- )
278
-
279
- reuse_button.click(
280
- fn=lambda image: image,
281
- inputs=[result],
282
- outputs=[input_image]
283
  )
284
 
285
  # Initialize gallery
 
114
  ).images[0]
115
 
116
  # The seed value is no longer returned, as it's not being changed.
117
+ return image, lora_scale
118
 
119
  except Exception as e:
120
  print(f"Error during inference: {e}")
121
  # Return an error state for all outputs
122
+ return None, lora_scale
123
 
124
  # CSS styling
125
  css = """
 
218
  )
219
  run_button = gr.Button("Generate", elem_id="run_button")
220
 
221
+ result = gr.Image(label="Generated Image", interactive=False, height=512)
 
222
 
223
  with gr.Accordion("Advanced Settings", open=False):
224
  lora_scale = gr.Slider(
 
272
  triggers=[run_button.click, prompt.submit],
273
  fn=infer_with_lora_wrapper,
274
  inputs=[input_image, prompt, selected_state, lora_state, custom_loaded_lora, seed, guidance_scale, num_inference_steps, lora_scale, gr_flux_loras],
275
+ outputs=[result, lora_state]
 
 
 
 
 
 
276
  )
277
 
278
  # Initialize gallery