Fabrice-TIERCELIN commited on
Commit
1470cc4
·
verified ·
1 Parent(s): 953b81d
Files changed (1) hide show
  1. app.py +58 -9
app.py CHANGED
@@ -43,9 +43,6 @@ vae = AutoencoderKLHunyuanVideo.from_pretrained("hunyuanvideo-community/HunyuanV
43
  feature_extractor = SiglipImageProcessor.from_pretrained("lllyasviel/flux_redux_bfl", subfolder='feature_extractor')
44
  image_encoder = SiglipVisionModel.from_pretrained("lllyasviel/flux_redux_bfl", subfolder='image_encoder', torch_dtype=torch.float16).cpu()
45
 
46
- # quant_config = DiffusersBitsAndBytesConfig(load_in_8bit=True)
47
- # transformer = HunyuanVideoTransformer3DModelPacked.from_single_file("https://huggingface.co/sirolim/FramePack_F1_I2V_FP8/resolve/main/FramePack_F1_I2V_HY_fp8_e4m3fn.safetensors", torch_dtype=torch.bfloat16)
48
- # transformer = HunyuanVideoTransformer3DModelPacked.from_single_file('sirolim/FramePack_F1_I2V_FP8', "FramePack_F1_I2V_HY_fp8_e4m3fn.safetensors", use_safetensors=True, torch_dtype=torch.bfloat16).cpu()
49
  transformer = HunyuanVideoTransformer3DModelPacked.from_pretrained('lllyasviel/FramePack_F1_I2V_HY_20250503', torch_dtype=torch.bfloat16).cpu()
50
 
51
  vae.eval()
@@ -351,6 +348,7 @@ def get_duration(input_image, prompt, t2v, n_prompt, seed, total_second_length,
351
  return total_second_length_debug_value * 60
352
  return total_second_length * 60
353
 
 
354
  @spaces.GPU(duration=get_duration)
355
  def process(input_image, prompt,
356
  t2v=False,
@@ -411,8 +409,11 @@ def end_process():
411
  css = make_progress_bar_css()
412
  block = gr.Blocks(css=css).queue()
413
  with block:
414
- gr.Markdown('# FramePack Essentials | Experimentation in Progress')
415
- gr.Markdown(f"""### Space is constantly being tinkered with, expect downtime and errors.
 
 
 
416
  """)
417
  with gr.Row():
418
  with gr.Column():
@@ -421,10 +422,10 @@ with block:
421
  t2v = gr.Checkbox(label="do text-to-video", value=False)
422
 
423
  with gr.Row():
424
- start_button = gr.Button(value="Start Generation")
425
- end_button = gr.Button(value="End Generation", interactive=False)
426
 
427
- total_second_length = gr.Slider(label="Total Video Length (Seconds)", minimum=1, maximum=5, value=2, step=0.1)
428
  with gr.Group():
429
  with gr.Accordion("Advanced settings", open=False):
430
  use_teacache = gr.Checkbox(label='Use TeaCache', value=True, info='Faster speed, but often makes hands and fingers slightly worse.')
@@ -488,6 +489,54 @@ with block:
488
  True, # use_teacache
489
  16 # mp4_crf
490
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
491
  ],
492
  run_on_click = True,
493
  fn = process,
@@ -523,4 +572,4 @@ with block:
523
  )
524
 
525
 
526
- block.launch(ssr_mode=False)
 
43
  feature_extractor = SiglipImageProcessor.from_pretrained("lllyasviel/flux_redux_bfl", subfolder='feature_extractor')
44
  image_encoder = SiglipVisionModel.from_pretrained("lllyasviel/flux_redux_bfl", subfolder='image_encoder', torch_dtype=torch.float16).cpu()
45
 
 
 
 
46
  transformer = HunyuanVideoTransformer3DModelPacked.from_pretrained('lllyasviel/FramePack_F1_I2V_HY_20250503', torch_dtype=torch.bfloat16).cpu()
47
 
48
  vae.eval()
 
348
  return total_second_length_debug_value * 60
349
  return total_second_length * 60
350
 
351
+
352
  @spaces.GPU(duration=get_duration)
353
  def process(input_image, prompt,
354
  t2v=False,
 
409
  css = make_progress_bar_css()
410
  block = gr.Blocks(css=css).queue()
411
  with block:
412
+ gr.Markdown('# FramePack-F1')
413
+ gr.Markdown(f"""### Video diffusion, but feels like image diffusion
414
+ *FramePack F1 - a FramePack model that only predicts future frames from history frames*
415
+ ### *beta* FramePack Fill 🖋️- draw a mask over the input image to inpaint the video output
416
+ adapted from the officical code repo [FramePack](https://github.com/lllyasviel/FramePack) by [lllyasviel](lllyasviel/FramePack_F1_I2V_HY_20250503) and [FramePack Studio](https://github.com/colinurbs/FramePack-Studio) 🙌🏻
417
  """)
418
  with gr.Row():
419
  with gr.Column():
 
422
  t2v = gr.Checkbox(label="do text-to-video", value=False)
423
 
424
  with gr.Row():
425
+ start_button = gr.Button(value="Start Generation", variant="primary")
426
+ end_button = gr.Button(value="End Generation", variant="stop", interactive=False)
427
 
428
+ total_second_length = gr.Slider(label="Generated Video Length (Seconds)", minimum=1, maximum=5, value=2, step=0.1)
429
  with gr.Group():
430
  with gr.Accordion("Advanced settings", open=False):
431
  use_teacache = gr.Checkbox(label='Use TeaCache', value=True, info='Faster speed, but often makes hands and fingers slightly worse.')
 
489
  True, # use_teacache
490
  16 # mp4_crf
491
  ],
492
+ [
493
+ "./img_examples/Example1.png", # input_image
494
+ "A dolphin emerges from the water, photorealistic, realistic, intricate details, 8k, insanely detailed",
495
+ False, # t2v
496
+ "", # n_prompt
497
+ 42, # seed
498
+ 1, # total_second_length
499
+ 9, # latent_window_size
500
+ 25, # steps
501
+ 1.0, # cfg
502
+ 10.0, # gs
503
+ 0.0, # rs
504
+ 6, # gpu_memory_preservation
505
+ True, # use_teacache
506
+ 16 # mp4_crf
507
+ ],
508
+ [
509
+ "./img_examples/Example1.png", # input_image
510
+ "We are sinking, photorealistic, realistic, intricate details, 8k, insanely detailed",
511
+ False, # t2v
512
+ "", # n_prompt
513
+ 42, # seed
514
+ 1, # total_second_length
515
+ 9, # latent_window_size
516
+ 25, # steps
517
+ 1.0, # cfg
518
+ 10.0, # gs
519
+ 0.0, # rs
520
+ 6, # gpu_memory_preservation
521
+ True, # use_teacache
522
+ 16 # mp4_crf
523
+ ],
524
+ [
525
+ "./img_examples/Example1.png", # input_image
526
+ "A boat is passing, photorealistic, realistic, intricate details, 8k, insanely detailed",
527
+ False, # t2v
528
+ "", # n_prompt
529
+ 42, # seed
530
+ 1, # total_second_length
531
+ 9, # latent_window_size
532
+ 25, # steps
533
+ 1.0, # cfg
534
+ 10.0, # gs
535
+ 0.0, # rs
536
+ 6, # gpu_memory_preservation
537
+ True, # use_teacache
538
+ 16 # mp4_crf
539
+ ],
540
  ],
541
  run_on_click = True,
542
  fn = process,
 
572
  )
573
 
574
 
575
+ block.launch(share=True, mcp_server=True, ssr_mode=True)