Keltezaa commited on
Commit
289510d
·
verified ·
1 Parent(s): 4440926

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -455,6 +455,7 @@ def generate_image(prompt_mash, steps, seed, cfg_scale, width, height, progress)
455
  print("Generating image...")
456
  pipe.to("cuda")
457
  generator = torch.Generator(device="cuda").manual_seed(seed)
 
458
  with calculateDuration("Generating image"):
459
  # Generate image
460
  for img in pipe.flux_pipe_call_that_returns_an_iterable_of_images(
@@ -470,7 +471,8 @@ def generate_image(prompt_mash, steps, seed, cfg_scale, width, height, progress)
470
  ):
471
  print("Image generated successfully.") # Debugging statement
472
  yield img
473
- return final_image
 
474
 
475
  @spaces.GPU(duration=75)
476
  def run_lora(prompt, cfg_scale, steps, selected_indices, lora_scale_1, lora_scale_2, lora_scale_3, lora_scale_4, randomize_seed, seed, width, height, loras_state, image_input=None, progress=gr.Progress(track_tqdm=True)):
 
455
  print("Generating image...")
456
  pipe.to("cuda")
457
  generator = torch.Generator(device="cuda").manual_seed(seed)
458
+ final_image = None # Initialize final_image
459
  with calculateDuration("Generating image"):
460
  # Generate image
461
  for img in pipe.flux_pipe_call_that_returns_an_iterable_of_images(
 
471
  ):
472
  print("Image generated successfully.") # Debugging statement
473
  yield img
474
+ final_image = img # Update final_image with the current image
475
+ return final_image
476
 
477
  @spaces.GPU(duration=75)
478
  def run_lora(prompt, cfg_scale, steps, selected_indices, lora_scale_1, lora_scale_2, lora_scale_3, lora_scale_4, randomize_seed, seed, width, height, loras_state, image_input=None, progress=gr.Progress(track_tqdm=True)):