AnimeOverlord commited on
Commit
e94694b
·
1 Parent(s): fe18223

new update fix

Browse files
Files changed (1) hide show
  1. app.py +16 -5
app.py CHANGED
@@ -838,7 +838,6 @@ def minecraftify(
838
  return _minecraftify_image(image, steps, guidance_scale, seed, extra_details)
839
 
840
 
841
- @spaces.GPU(duration=60)
842
  def _minecraftify_live_frame(
843
  frame: Image.Image,
844
  steps: int,
@@ -846,8 +845,8 @@ def _minecraftify_live_frame(
846
  seed: int,
847
  extra_details: str,
848
  ):
849
- """GPU-wrapped inference for individual live frames."""
850
- log_event(f"GPU-allocated: Processing live frame with steps={steps}")
851
  return _minecraftify_image(frame, steps, guidance_scale, seed, extra_details)
852
 
853
 
@@ -870,13 +869,14 @@ def capture_live_frame(image: Image.Image):
870
  return None
871
 
872
 
873
- def minecraftify_live_loop(
874
  steps: int,
875
  guidance_scale: float,
876
  seed: int,
877
  extra_details: str,
878
  ):
879
- log_event("Live GPU loop started")
 
880
  last_processed_frame_id = 0
881
 
882
  while True:
@@ -903,6 +903,17 @@ def minecraftify_live_loop(
903
  yield output
904
 
905
 
 
 
 
 
 
 
 
 
 
 
 
906
  def _set_live_active(image: Image.Image):
907
  """Auto-enable live processing when recording starts."""
908
  global _live_active
 
838
  return _minecraftify_image(image, steps, guidance_scale, seed, extra_details)
839
 
840
 
 
841
  def _minecraftify_live_frame(
842
  frame: Image.Image,
843
  steps: int,
 
845
  seed: int,
846
  extra_details: str,
847
  ):
848
+ """Inference for individual live frames (GPU held at loop level)."""
849
+ log_event(f"Processing live frame with steps={steps}")
850
  return _minecraftify_image(frame, steps, guidance_scale, seed, extra_details)
851
 
852
 
 
869
  return None
870
 
871
 
872
+ def _minecraftify_live_loop_gpu(
873
  steps: int,
874
  guidance_scale: float,
875
  seed: int,
876
  extra_details: str,
877
  ):
878
+ """GPU-held loop for live processing - holds GPU for 120 seconds."""
879
+ log_event("Live GPU loop started (GPU allocated for 120s)")
880
  last_processed_frame_id = 0
881
 
882
  while True:
 
903
  yield output
904
 
905
 
906
+ @spaces.GPU(duration=120)
907
+ def minecraftify_live_loop(
908
+ steps: int,
909
+ guidance_scale: float,
910
+ seed: int,
911
+ extra_details: str,
912
+ ):
913
+ """Wrapper that holds GPU for entire 120-second live stream session."""
914
+ yield from _minecraftify_live_loop_gpu(steps, guidance_scale, seed, extra_details)
915
+
916
+
917
  def _set_live_active(image: Image.Image):
918
  """Auto-enable live processing when recording starts."""
919
  global _live_active