from typing import List, Union import tempfile import numpy as np import PIL.Image…
- User
from typing import List, Union import tempfile import numpy as np import PIL.Image import imageio
def export_to_video( video_frames: Union[List[np.ndarray], List[PIL.Image.Image]], output_video_path: str = None, fps: int = 10 ) -> str: if output_video_path is None: output_video_path = tempfile.NamedTemporaryFile(suffix=".mp4").name if isinstance(video_frames[0], np.ndarray): video_frames = [(frame * 255).astype(np.uint8) for frame in video_frames] elif isinstance(video_frames[0], PIL.Image.Image): video_frames = [np.array(frame) for frame in video_frames] writer = imageio.get_writer(output_video_path, fps=fps) for frame in video_frames: writer.append_data(frame) writer.close() return output_video_path
export_to_video(output.frames[0], "animation.mp4") from IPython.display import Video Video("/content/animation.mp4", embed=True)
- Assistant
- User
how make long video
- Assistant
- User
animatediff how make long video
- Assistant
- User
Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/content/animatediff/scripts/animate.py", line 9, in import diffusers File "/usr/local/lib/python3.10/dist-packages/diffusers/init.py", line 46, in from .pipeline_utils import DiffusionPipeline File "/usr/local/lib/python3.10/dist-packages/diffusers/pipeline_utils.py", line 35, in from .dynamic_modules_utils import get_class_from_dynamic_module File "/usr/local/lib/python3.10/dist-packages/diffusers/dynamic_modules_utils.py", line 29, in from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info ImportError: cannot import name 'cached_download' from 'huggingface_hub' (/usr/local/lib/python3.10/dist-packages/huggingface_hub/init.py)
- Assistant
The error you're encountering is due to a mismatch between the versions of the
diffuserslibrary and thehuggingface_hublibrary. Thecached_downloadfunction has been deprecated and removed in recent updates of the package, which is why you're seeing this . - User
how make camera side to side in 768x1344 resolution image using this script: depth_edge_model_ckpt: checkpoints/edge-model.pth depth_feat_model_ckpt: checkpoints/depth-model.pth rgb_feat_model_ckpt: checkpoints/color-model.pth MiDaS_model_ckpt: MiDaS/model.pt use_boostmonodepth: True fps: 40 num_frames: 240 x_shift_range: [-0.5, -0.05, 0.05, -0.05] y_shift_range: [0.00, 0.00, -0.015, -0.00] z_shift_range: [-0.05, -0.05, -0.05, -0.05] traj_types: ['double-straight-line', 'double-straight-line', 'circle', 'circle'] video_postfix: ['dolly-zoom-in', 'zoom-in', 'circle', 'swing'] specific: '' longer_side_len: 960 src_folder: image depth_folder: depth mesh_folder: mesh video_folder: video load_ply: False save_ply: True inference_video: True gpu_ids: 0 offscreen_rendering: True img_format: '.jpg' depth_format: '.npy' require_midas: True depth_threshold: 0.04 ext_edge_threshold: 0.002 sparse_iter: 5 filter_size: [7, 7, 5, 5, 5] sigma_s: 4.0 sigma_r: 0.5 redundant_number: 12 background_thickness: 70 context_thickness: 140 background_thickness_2: 70 context_thickness_2: 70 discount_factor: 1.00 log_depth: True largest_size: 512 depth_edge_dilate: 10 depth_edge_dilate_2: 5 extrapolate_border: True extrapolation_thickness: 60 repeat_inpaint_edge: True crop_border: [0.03, 0.03, 0.05, 0.03] anti_flickering: True
- Assistant
- User
mostre o movimento da camera de acordo com o script
- Assistant
- User
explique cada parametro deste
- Assistant
- User
x_shift_range oque representa estes parametros: [-0.5, -0.05, 0.05, -0.05] cada numero como seria o movimento
- Assistant
The
x_shift_rangeparameter specifies the sequence of horizontal shifts for the camera movement in each frame of your animation. The entries in this list represent the extent and direction of each horizontal shift that the camera should undergo during the animation sequence. Here's a breakdown of what each value implies:-
: This indicates a significant leftward shift. The camera's initial movement will be to the left by half the extent of the shift scale defined. It's likely the starting point to initiate a side-to-side motion.
-
- User
how make this camera parametri : moving up to down with little moviment left to right
- Assistant
- User
add this to script
- Assistant