Video Input (Local File Upload)
Code
1from pathlib import Path23from kern.agent import Agent4from kern.media import Video5from kern.models.google import Gemini67agent = Agent(8 model=Gemini(id="gemini-2.0-flash-exp"),9 markdown=True,10)1112# Get sample videos from https://www.pexels.com/search/videos/sample/13video_path = Path(__file__).parent.joinpath("sample_video.mp4")1415agent.print_response("Tell me about this video?", videos=[Video(filepath=video_path)])Usage
Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateSet your API key
1export GOOGLE_API_KEY=xxxInstall dependencies
1uv pip install -U google-genai kern-aiRun Agent
1python cookbook/11_models/google/gemini/video_input_local_file_upload.py