KingNish commited on
Commit
a9c173a
·
verified ·
1 Parent(s): 8effdde

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -13
app.py CHANGED
@@ -198,7 +198,6 @@ with gr.Blocks() as demo:
198
  show_progress="full",
199
  queue=False,
200
  concurrency_limit=None,
201
- fn_kwargs={"is_enhance": True} # Pass the flag to indicate enhance
202
  )
203
 
204
  generateBtn.click(
@@ -216,6 +215,10 @@ with gr.Blocks() as demo:
216
  generateBtn: gr.update(visible=not realtime_enabled)
217
  }
218
 
 
 
 
 
219
  realtime.change(
220
  fn=update_ui,
221
  inputs=[realtime],
@@ -238,7 +241,7 @@ with gr.Blocks() as demo:
238
 
239
  for component in [prompt, width, height, num_inference_steps]:
240
  component.input(
241
- fn=handle_realtime_update, # Call the wrapper that checks the toggle
242
  inputs=[realtime, prompt, seed, width, height, randomize_seed, num_inference_steps],
243
  outputs=[result, seed, latency],
244
  show_progress="hidden",
@@ -246,17 +249,6 @@ with gr.Blocks() as demo:
246
  queue=False,
247
  concurrency_limit=None
248
  )
249
-
250
- # Also trigger realtime on seed change if randomize is off
251
- seed.input(
252
- fn=handle_realtime_update,
253
- inputs=[realtime, prompt, seed, width, height, randomize_seed, num_inference_steps],
254
- outputs=[result, seed, latency],
255
- show_progress="hidden",
256
- trigger_mode="always_last",
257
- queue=False,
258
- concurrency_limit=None
259
- )
260
 
261
  # Launch the app
262
  demo.launch()
 
198
  show_progress="full",
199
  queue=False,
200
  concurrency_limit=None,
 
201
  )
202
 
203
  generateBtn.click(
 
215
  generateBtn: gr.update(visible=not realtime_enabled)
216
  }
217
 
218
+ def realtime_generation(*args):
219
+ if args[0]: # If realtime is enabled
220
+ return next(generate_image(*args[1:]))
221
+
222
  realtime.change(
223
  fn=update_ui,
224
  inputs=[realtime],
 
241
 
242
  for component in [prompt, width, height, num_inference_steps]:
243
  component.input(
244
+ fn=realtime_generation,
245
  inputs=[realtime, prompt, seed, width, height, randomize_seed, num_inference_steps],
246
  outputs=[result, seed, latency],
247
  show_progress="hidden",
 
249
  queue=False,
250
  concurrency_limit=None
251
  )
 
 
 
 
 
 
 
 
 
 
 
252
 
253
  # Launch the app
254
  demo.launch()