Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions PromptClip_multimodal.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,19 @@
"load_dotenv()\n",
"\n",
"# Connect to VideoDB\n",
"conn = videodb.connect()\n",
"conn = videodb.connect(api_key="") # API KEY FOR VIDEODB\n",
"coll = conn.get_collection()\n",
"\n",
"# TODO: Add video_id if video already exists in the collection\n",
"video_id = os.getenv(\"MULTIMODAL_DEMO_VIDEO_ID\")\n",
"video_id = "MULTIMODAL_DEMO_VIDEO_ID\n",
"video_url = \"https://www.youtube.com/watch?v=NZGLHdcw2RM\"\n",
"\n",
"if not video_id:\n",
" video = coll.upload(url=video_url)\n",
"else:\n",
" video = coll.get_video(video_id)\n",
"\n",
"print(f\"video_id: {video.id}, name: {video.name}\")\n",
"print(f"VIDEO ID: {video.id}, VIDEO NAME: {video.name}")\n",
"video.play()"
]
},
Expand Down Expand Up @@ -116,14 +116,21 @@
"outputs": [],
"source": [
"# Add scene_index_id here if already indexed.\n",
"scene_index_id = os.getenv(\"MULTIMODAL_DEMO_SCENE_INDEX_ID\")\n",
"\n",
"scene_index_id = ""\n",
"if scene_index_id:\n",
" # If scene_index_id is provided, retrieve the scenes using it.\n",
" try:\n",
" print(f"Using scene index ID: {scene_index_id}")\n",
" scenes = video.get_scene_index(scene_index_id)\n",
" except Exception as e:\n",
"print(f"Error retrieving scenes from scene index: {e}")\n",

"if not scene_index_id:\n",
" scene_index_id = video.index_scenes(\n",
" prompt=\"Summarize the essence of the scene in one or two concise sentences.\"\n",
" )\n",
"scenes = video.get_scene_index(scene_index_id)\n",
"print(f\"Video is indexed with scene_index_id {scene_index_id} and has {len(scenes)} scenes.\")"
"print(f"Scene Count: {len(scenes)}\n")"
]
},
{
Expand Down
Loading