MCPcopy
hub / github.com/mudler/LocalAI / load_video

Method load_video

backend/python/vllm/backend.py:873–893  ·  view source on GitHub ↗

Load a video from the given file path. Args: video_path (str): The path to the image file. Returns: Video: The loaded video.

(self, video_path: str)

Source from the content-addressed store, hash-verified

871 return None
872
873 def load_video(self, video_path: str):
874 """
875 Load a video from the given file path.
876
877 Args:
878 video_path (str): The path to the image file.
879
880 Returns:
881 Video: The loaded video.
882 """
883 try:
884 timestamp = str(int(time.time() * 1000)) # Generate timestamp
885 p = os.path.join(tempfile.gettempdir(), f"vl-{timestamp}.data")
886 with open(p, "wb") as f:
887 f.write(base64.b64decode(video_path))
888 video = VideoAsset(name=p).np_ndarrays
889 os.remove(p)
890 return video
891 except Exception as e:
892 print(f"Error loading video {video_path}: {e}", file=sys.stderr)
893 return None
894
895async def serve(address):
896 # Start asyncio gRPC server

Callers 1

_predictMethod · 0.95

Calls 4

openFunction · 0.85
timeMethod · 0.45
writeMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected