jbilcke-hf HF Staff commited on
Commit
2f939c6
·
1 Parent(s): 396c421

adding more logs to debug

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -53,6 +53,9 @@ import numpy as np
53
 
54
  device = "cuda" if torch.cuda.is_available() else "cpu"
55
 
 
 
 
56
  # --- Argument Parsing ---
57
  parser = argparse.ArgumentParser(description="Gradio Demo for Self-Forcing with Frame Streaming")
58
  parser.add_argument('--port', type=int, default=7860, help="Port to run the Gradio app on.")
@@ -230,7 +233,7 @@ pipeline = CausalInferencePipeline(
230
  pipeline.to(dtype=torch.float16).to(gpu)
231
 
232
  @torch.no_grad()
233
- def video_generation_handler_streaming(prompt, seed=42, fps=15, width=400, height=224, duration=5):
234
  """
235
  Generator function that yields .ts video chunks using PyAV for streaming.
236
  """
@@ -240,16 +243,17 @@ def video_generation_handler_streaming(prompt, seed=42, fps=15, width=400, heigh
240
  if fps is None:
241
  fps = 15
242
  if width is None:
243
- width = 400
244
  if height is None:
245
- height = 224
246
  if duration is None:
247
  duration = 5
248
 
249
  if seed == -1:
250
  seed = random.randint(0, 2**32 - 1)
251
 
252
- # print(f"🎬 Starting PyAV streaming: seed: {seed}, duration: {duration}s")
 
253
 
254
  # Setup
255
  conditional_dict = text_encoder(text_prompts=[prompt])
@@ -458,16 +462,16 @@ with gr.Blocks(title="Wan2.1 1.3B Self-Forcing streaming demo") as demo:
458
  width = gr.Slider(
459
  label="Width",
460
  minimum=224,
461
- maximum=720,
462
- value=400,
463
  step=8,
464
  info="Video width in pixels (8px steps)"
465
  )
466
  height = gr.Slider(
467
  label="Height",
468
  minimum=224,
469
- maximum=720,
470
- value=224,
471
  step=8,
472
  info="Video height in pixels (8px steps)"
473
  )
 
53
 
54
  device = "cuda" if torch.cuda.is_available() else "cpu"
55
 
56
+ DEFAULT_WIDTH = 832
57
+ DEFAULT_HEIGHT = 480
58
+
59
  # --- Argument Parsing ---
60
  parser = argparse.ArgumentParser(description="Gradio Demo for Self-Forcing with Frame Streaming")
61
  parser.add_argument('--port', type=int, default=7860, help="Port to run the Gradio app on.")
 
233
  pipeline.to(dtype=torch.float16).to(gpu)
234
 
235
  @torch.no_grad()
236
+ def video_generation_handler_streaming(prompt, seed=42, fps=15, width=DEFAULT_WIDTH, height=DEFAULT_HEIGHT, duration=5):
237
  """
238
  Generator function that yields .ts video chunks using PyAV for streaming.
239
  """
 
243
  if fps is None:
244
  fps = 15
245
  if width is None:
246
+ width = DEFAULT_WIDTH
247
  if height is None:
248
+ height = DEFAULT_HEIGHT
249
  if duration is None:
250
  duration = 5
251
 
252
  if seed == -1:
253
  seed = random.randint(0, 2**32 - 1)
254
 
255
+
256
+ print(f"🎬 video_generation_handler_streaming called, seed: {seed}, duration: {duration}s, fps: {fps}, width: {width}, height: {height}")
257
 
258
  # Setup
259
  conditional_dict = text_encoder(text_prompts=[prompt])
 
462
  width = gr.Slider(
463
  label="Width",
464
  minimum=224,
465
+ maximum=832,
466
+ value=DEFAULT_WIDTH,
467
  step=8,
468
  info="Video width in pixels (8px steps)"
469
  )
470
  height = gr.Slider(
471
  label="Height",
472
  minimum=224,
473
+ maximum=832,
474
+ value=DEFAULT_HEIGHT,
475
  step=8,
476
  info="Video height in pixels (8px steps)"
477
  )