Oysiyl Claude Sonnet 4.5 commited on
Commit
5b93491
·
1 Parent(s): ab7b2f9

Fix image flash bug - remove 4 unnecessary yields

Browse files

Removed yields that caused brief flashes of outdated images before
showing properly decoded results. This affected both standard and
artistic pipelines during first and second enhancement passes.

Removed yields:
- Standard line 1944: Black/white QR after first sampling
- Standard line 2031: First pass result after second sampling
- Artistic line 2369: Old QR after first sampling
- Artistic line 2464: First pass result after second sampling

Users now see smooth progression from animation frames directly to
final decoded images without intermediate flashes. Progress messages
still update via log_progress().

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -1938,10 +1938,10 @@ def _pipeline_standard(
1938
  latent_image=get_value_at_index(emptylatentimage_5, 0),
1939
  )
1940
 
1941
- # Yield progress update after first sampling completes
1942
  msg = "First pass sampling complete... decoding image"
1943
  log_progress(msg, gr_progress, 0.4)
1944
- yield base_qr_pil, msg # Yield with same image as before
1945
 
1946
  # Calculate optimal tile size for this image - disable for now
1947
  # tile_size, overlap = calculate_vae_tile_size(image_size)
@@ -2025,10 +2025,10 @@ def _pipeline_standard(
2025
  latent_image=get_value_at_index(emptylatentimage_17, 0),
2026
  )
2027
 
2028
- # Yield progress update after second sampling completes
2029
  msg = "Second pass sampling complete... decoding final image"
2030
  log_progress(msg, gr_progress, 0.8)
2031
- yield mid_pil, msg # Yield with previous image
2032
 
2033
  # Second pass is always 2x original, calculate based on doubled size
2034
  tile_size_2x, overlap_2x = calculate_vae_tile_size(image_size * 2)
@@ -2363,10 +2363,10 @@ def _pipeline_artistic(
2363
  latent_image=get_value_at_index(latent_image, 0),
2364
  )
2365
 
2366
- # Yield progress update after first sampling completes
2367
  msg = f"First pass sampling complete... decoding image (step {current_step}/{total_steps})"
2368
  log_progress(msg, gr_progress, 0.4)
2369
- yield (noisy_qr_pil if border_size > 0 else base_qr_pil, msg)
2370
 
2371
  # First decode with dynamic tiling - disable for now
2372
  # tile_size, overlap = calculate_vae_tile_size(image_size)
@@ -2458,10 +2458,10 @@ def _pipeline_artistic(
2458
  latent_image=get_value_at_index(upscaled_latent, 0),
2459
  )
2460
 
2461
- # Yield progress update after second sampling completes
2462
  msg = f"Second pass sampling complete... decoding final image (step {current_step}/{total_steps})"
2463
  log_progress(msg, gr_progress, 0.8)
2464
- yield (first_pass_pil, msg)
2465
 
2466
  # Final decode with dynamic tiling
2467
  tile_size, overlap = calculate_vae_tile_size(image_size)
 
1938
  latent_image=get_value_at_index(emptylatentimage_5, 0),
1939
  )
1940
 
1941
+ # Progress update after first sampling completes (no yield to avoid showing base QR)
1942
  msg = "First pass sampling complete... decoding image"
1943
  log_progress(msg, gr_progress, 0.4)
1944
+ # Removed yield here - caused flash of black/white QR before decoded image
1945
 
1946
  # Calculate optimal tile size for this image - disable for now
1947
  # tile_size, overlap = calculate_vae_tile_size(image_size)
 
2025
  latent_image=get_value_at_index(emptylatentimage_17, 0),
2026
  )
2027
 
2028
+ # Progress update after second sampling completes (no yield to avoid showing first pass)
2029
  msg = "Second pass sampling complete... decoding final image"
2030
  log_progress(msg, gr_progress, 0.8)
2031
+ # Removed yield here - caused flash of first pass image before final decoded
2032
 
2033
  # Second pass is always 2x original, calculate based on doubled size
2034
  tile_size_2x, overlap_2x = calculate_vae_tile_size(image_size * 2)
 
2363
  latent_image=get_value_at_index(latent_image, 0),
2364
  )
2365
 
2366
+ # Progress update after first sampling completes (no yield to avoid showing old QR)
2367
  msg = f"First pass sampling complete... decoding image (step {current_step}/{total_steps})"
2368
  log_progress(msg, gr_progress, 0.4)
2369
+ # Removed yield here - caused flash of old QR before decoded image
2370
 
2371
  # First decode with dynamic tiling - disable for now
2372
  # tile_size, overlap = calculate_vae_tile_size(image_size)
 
2458
  latent_image=get_value_at_index(upscaled_latent, 0),
2459
  )
2460
 
2461
+ # Progress update after second sampling completes (no yield to avoid showing first pass)
2462
  msg = f"Second pass sampling complete... decoding final image (step {current_step}/{total_steps})"
2463
  log_progress(msg, gr_progress, 0.8)
2464
+ # Removed yield here - caused flash of first pass image before final decoded
2465
 
2466
  # Final decode with dynamic tiling
2467
  tile_size, overlap = calculate_vae_tile_size(image_size)