github-actions[bot] commited on
Commit
bd97d92
·
1 Parent(s): 1dda790

Deploy from GitHub - 2026-01-21 11:58:01

Browse files
Files changed (1) hide show
  1. app.py +30 -9
app.py CHANGED
@@ -1561,29 +1561,30 @@ def stylize_image_impl(
1561
 
1562
  # Wrap with GPU decorator for ZeroGPU if available
1563
  # ZeroGPU requires ALL GPU-using functions to be decorated with @GPU
 
1564
  if SPACES_AVAILABLE:
1565
  try:
1566
  stylize_image = GPU(stylize_image_impl)
1567
  train_custom_style = GPU(train_custom_style_impl)
1568
  extract_style_from_image = GPU(extract_style_from_image_impl)
1569
- create_style_blend_output = GPU(create_style_blend_output_impl)
1570
- apply_region_style = GPU(apply_region_style_impl)
1571
- apply_region_style_ui = GPU(apply_region_style_ui_impl)
1572
  except Exception:
1573
  # Fallback if GPU decorator fails
1574
  stylize_image = stylize_image_impl
1575
  train_custom_style = train_custom_style_impl
1576
  extract_style_from_image = extract_style_from_image_impl
1577
- create_style_blend_output = create_style_blend_output_impl
1578
- apply_region_style = apply_region_style_impl
1579
- apply_region_style_ui = apply_region_style_ui_impl
1580
  else:
1581
  stylize_image = stylize_image_impl
1582
  train_custom_style = train_custom_style_impl
1583
  extract_style_from_image = extract_style_from_image_impl
1584
- create_style_blend_output = create_style_blend_output_impl
1585
- apply_region_style = apply_region_style_impl
1586
- apply_region_style_ui = apply_region_style_ui_impl
1587
 
1588
 
1589
  def process_webcam_frame(image: Image.Image, style: str, backend: str) -> Image.Image:
@@ -1815,6 +1816,26 @@ def create_style_blend_output_impl(
1815
  return output_image
1816
 
1817
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1818
  # ============================================================================
1819
  # Build Gradio Interface
1820
  # ============================================================================
 
1561
 
1562
  # Wrap with GPU decorator for ZeroGPU if available
1563
  # ZeroGPU requires ALL GPU-using functions to be decorated with @GPU
1564
+ # Note: This must come AFTER the function definitions below
1565
  if SPACES_AVAILABLE:
1566
  try:
1567
  stylize_image = GPU(stylize_image_impl)
1568
  train_custom_style = GPU(train_custom_style_impl)
1569
  extract_style_from_image = GPU(extract_style_from_image_impl)
1570
+ # apply_region_style = GPU(apply_region_style_impl)
1571
+ # apply_region_style_ui = GPU(apply_region_style_ui_impl)
1572
+ # create_style_blend_output will be wrapped after function definition
1573
  except Exception:
1574
  # Fallback if GPU decorator fails
1575
  stylize_image = stylize_image_impl
1576
  train_custom_style = train_custom_style_impl
1577
  extract_style_from_image = extract_style_from_image_impl
1578
+ # create_style_blend_output = create_style_blend_output_impl
1579
+ # apply_region_style = apply_region_style_impl
1580
+ # apply_region_style_ui = apply_region_style_ui_impl
1581
  else:
1582
  stylize_image = stylize_image_impl
1583
  train_custom_style = train_custom_style_impl
1584
  extract_style_from_image = extract_style_from_image_impl
1585
+ # create_style_blend_output = create_style_blend_output_impl
1586
+ # apply_region_style = apply_region_style_impl
1587
+ # apply_region_style_ui = apply_region_style_ui_impl
1588
 
1589
 
1590
  def process_webcam_frame(image: Image.Image, style: str, backend: str) -> Image.Image:
 
1816
  return output_image
1817
 
1818
 
1819
+ # ============================================================================
1820
+ # Complete GPU wrapping for functions defined above
1821
+ # ============================================================================
1822
+ # Now wrap the remaining functions that were defined after the initial GPU wrapping
1823
+
1824
+ if SPACES_AVAILABLE:
1825
+ try:
1826
+ create_style_blend_output = GPU(create_style_blend_output_impl)
1827
+ apply_region_style = GPU(apply_region_style_impl)
1828
+ apply_region_style_ui = GPU(apply_region_style_ui_impl)
1829
+ except Exception:
1830
+ create_style_blend_output = create_style_blend_output_impl
1831
+ apply_region_style = apply_region_style_impl
1832
+ apply_region_style_ui = apply_region_style_ui_impl
1833
+ else:
1834
+ create_style_blend_output = create_style_blend_output_impl
1835
+ apply_region_style = apply_region_style_impl
1836
+ apply_region_style_ui = apply_region_style_ui_impl
1837
+
1838
+
1839
  # ============================================================================
1840
  # Build Gradio Interface
1841
  # ============================================================================