From 972f44c2fc74e5eb3f4e9290b6baf4d5b6a9f305 Mon Sep 17 00:00:00 2001 From: Sarvesh Date: Tue, 9 Jun 2026 15:44:41 +0530 Subject: [PATCH] Auto download sample video if not found locally in demo.ipynb --- demo.ipynb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/demo.ipynb b/demo.ipynb index 9aa570d..7b5ae7f 100644 --- a/demo.ipynb +++ b/demo.ipynb @@ -146,7 +146,26 @@ " \"target_text\": \"Little boy watering plants outdoors; Using watering can to pour water into flower pot; Shifting camera angle from side view to rear view; Tapping edge of flower pot a few times; Setting down watering can\"\n", "}\n", "\n", - "print(f\"Video ID: {sample_example['id']}\")\n", + "import os\n", + "import urllib.request\n", + "\n", + "video_path = sample_example[\"video_path\"]\n", + "if not os.path.exists(video_path):\n", + " print(f\"Video file not found at: {video_path}\")\n", + " print(\"Downloading a public sample video to run the demo...\")\n", + " os.makedirs(os.path.dirname(video_path), exist_ok=True)\n", + " # Download a lightweight sample video (1.8MB)\n", + " sample_url = \"https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4\"\n", + " try:\n", + " urllib.request.urlretrieve(sample_url, video_path)\n", + " print(f\"Sample video successfully downloaded to: {video_path}\")\n", + " except Exception as e:\n", + " print(f\"Failed to download sample video: {e}\")\n", + " print(\"Please place a valid video at the path above.\")\n", + "else:\n", + " print(f\"Found video file at: {video_path}\")\n", + "\n", + "print(f\"\\nVideo ID: {sample_example['id']}\")\n", "print(f\"Prompt: {sample_example['prompt']}\")\n", "print(f\"Ground Truth: {sample_example['target_text']}\")" ]