AnimeOverlord commited on
Commit
02802a5
·
1 Parent(s): c24d178

fixed error

Browse files
Files changed (1) hide show
  1. app.py +5 -10
app.py CHANGED
@@ -838,7 +838,7 @@ def minecraftify(
838
  return _minecraftify_image(image, steps, guidance_scale, seed, extra_details)
839
 
840
 
841
- @spaces.GPU(duration=120)
842
  def _minecraftify_live_frame(
843
  frame: Image.Image,
844
  steps: int,
@@ -909,7 +909,7 @@ def _set_live_active(image: Image.Image):
909
  if image is not None and not _live_active:
910
  _live_active = True
911
  log_event("Live recording detected, auto-starting processing")
912
- return gr.update(active=_live_active) # Enable timer when active
913
 
914
 
915
  def switch_input_mode(mode: str):
@@ -927,7 +927,6 @@ def switch_input_mode(mode: str):
927
  gr.update(interactive=True),
928
  gr.update(visible=not image_mode, interactive=False),
929
  False,
930
- gr.update(active=not image_mode), # Deactivate timer in image mode
931
  )
932
 
933
 
@@ -1072,7 +1071,6 @@ with gr.Blocks(**BLOCKS_KWARGS) as demo:
1072
 
1073
  # ── Event binding ──
1074
  live_running = gr.State(False)
1075
- processing_timer = gr.Timer(value=0.1, active=False)
1076
 
1077
  input_mode.change(
1078
  fn=switch_input_mode,
@@ -1082,7 +1080,6 @@ with gr.Blocks(**BLOCKS_KWARGS) as demo:
1082
  run_btn,
1083
  live_input_group,
1084
  live_running,
1085
- processing_timer,
1086
  ],
1087
  queue=False,
1088
  )
@@ -1094,15 +1091,13 @@ with gr.Blocks(**BLOCKS_KWARGS) as demo:
1094
  )
1095
 
1096
  live_image.stream(
1097
- fn=_set_live_active,
1098
  inputs=live_image,
1099
- outputs=processing_timer,
1100
  stream_every=0.05,
1101
  trigger_mode="always_last",
1102
  queue=False,
1103
- )
1104
-
1105
- processing_timer.tick(
1106
  fn=minecraftify_live_loop,
1107
  inputs=[steps, guidance_scale, seed, extra_details],
1108
  outputs=[output_image],
 
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,
 
909
  if image is not None and not _live_active:
910
  _live_active = True
911
  log_event("Live recording detected, auto-starting processing")
912
+ return None
913
 
914
 
915
  def switch_input_mode(mode: str):
 
927
  gr.update(interactive=True),
928
  gr.update(visible=not image_mode, interactive=False),
929
  False,
 
930
  )
931
 
932
 
 
1071
 
1072
  # ── Event binding ──
1073
  live_running = gr.State(False)
 
1074
 
1075
  input_mode.change(
1076
  fn=switch_input_mode,
 
1080
  run_btn,
1081
  live_input_group,
1082
  live_running,
 
1083
  ],
1084
  queue=False,
1085
  )
 
1091
  )
1092
 
1093
  live_image.stream(
1094
+ fn=lambda img: _set_live_active(img),
1095
  inputs=live_image,
1096
+ outputs=None,
1097
  stream_every=0.05,
1098
  trigger_mode="always_last",
1099
  queue=False,
1100
+ ).then(
 
 
1101
  fn=minecraftify_live_loop,
1102
  inputs=[steps, guidance_scale, seed, extra_details],
1103
  outputs=[output_image],