QZFantasies commited on
Commit
93cb999
·
1 Parent(s): 0e589ae

add extra method for video saving

Browse files
Files changed (2) hide show
  1. LHM/utils/ffmpeg_utils.py +7 -1
  2. app.py +17 -17
LHM/utils/ffmpeg_utils.py CHANGED
@@ -57,4 +57,10 @@ def images_to_video(images, output_path, fps, gradio_codec: bool, verbose=False,
57
  frames = frames[:300]
58
 
59
  frames = np.stack(frames)
60
- iio.imwrite(output_path,frames,fps=fps,codec="libx264",pixelformat="yuv420p",bitrate=bitrate,macro_block_size=16)
 
 
 
 
 
 
 
57
  frames = frames[:300]
58
 
59
  frames = np.stack(frames)
60
+
61
+ try:
62
+ imageio.mimwrite(output_path, frames, fps=30, codec="libx264")
63
+ print("save {} using imageio.".format(output_path))
64
+ except:
65
+ iio.imwrite(output_path,frames,fps=fps,codec="libx264",pixelformat="yuv420p",bitrate=bitrate,macro_block_size=16)
66
+ print("save {} using imageio.v3 .".format(output_path))
app.py CHANGED
@@ -624,23 +624,23 @@ def demo_lhm(pose_estimator, face_detector, lhm, cfg):
624
  </div>
625
  """
626
  )
627
- gr.Markdown(
628
- """
629
- <p align="center">
630
- <a title="Website" href="https://lingtengqiu.github.io/LHM/" target="_blank" rel="noopener noreferrer" style="display: inline-block;">
631
- <img src="https://www.obukhov.ai/img/badges/badge-website.svg">
632
- </a>
633
- <a title="arXiv" href="https://arxiv.org/pdf/2503.10625" target="_blank" rel="noopener noreferrer" style="display: inline-block;">
634
- <img src="https://www.obukhov.ai/img/badges/badge-pdf.svg">
635
- </a>
636
- <a title="Github" href="https://github.com/aigc3d/LHM" target="_blank" rel="noopener noreferrer" style="display: inline-block;">
637
- <img src="https://img.shields.io/github/stars/aigc3d/LHM?label=GitHub%20%E2%98%85&logo=github&color=C8C" alt="badge-github-stars">
638
- </a>
639
- <a title="Video" href="https://www.youtube.com/watch?v=tivEpz_yiEo" target="_blank" rel="noopener noreferrer" style="display: inline-block;">
640
- <img src="https://img.shields.io/badge/YouTube-QiuLingteng-red?logo=youtube" alt="Video">
641
- </a>
642
- """
643
- )
644
  gr.HTML(
645
  """<p><h4 style="color: red;"> Notes: Please input full-body image in case of detection errors. We simplify the pipeline in spaces: 1) using Rembg instead of SAM2; 2) limit the output video length to 10s; For best visual quality, try the inference code on Github instead.</h4></p>"""
646
  )
 
624
  </div>
625
  """
626
  )
627
+ # gr.Markdown(
628
+ # """
629
+ # <p align="center">
630
+ # <a title="Website" href="https://lingtengqiu.github.io/LHM/" target="_blank" rel="noopener noreferrer" style="display: inline-block;">
631
+ # <img src="https://www.obukhov.ai/img/badges/badge-website.svg">
632
+ # </a>
633
+ # <a title="arXiv" href="https://arxiv.org/pdf/2503.10625" target="_blank" rel="noopener noreferrer" style="display: inline-block;">
634
+ # <img src="https://www.obukhov.ai/img/badges/badge-pdf.svg">
635
+ # </a>
636
+ # <a title="Github" href="https://github.com/aigc3d/LHM" target="_blank" rel="noopener noreferrer" style="display: inline-block;">
637
+ # <img src="https://img.shields.io/github/stars/aigc3d/LHM?label=GitHub%20%E2%98%85&logo=github&color=C8C" alt="badge-github-stars">
638
+ # </a>
639
+ # <a title="Video" href="https://www.youtube.com/watch?v=tivEpz_yiEo" target="_blank" rel="noopener noreferrer" style="display: inline-block;">
640
+ # <img src="https://img.shields.io/badge/YouTube-QiuLingteng-red?logo=youtube" alt="Video">
641
+ # </a>
642
+ # """
643
+ # )
644
  gr.HTML(
645
  """<p><h4 style="color: red;"> Notes: Please input full-body image in case of detection errors. We simplify the pipeline in spaces: 1) using Rembg instead of SAM2; 2) limit the output video length to 10s; For best visual quality, try the inference code on Github instead.</h4></p>"""
646
  )