mirror of
https://github.com/SakanaAI/doc-to-lora.git
synced 2026-07-23 17:01:04 +02:00
Auto download sample video if not found locally in demo.ipynb
This commit is contained in:
parent
03c4c96dd9
commit
972f44c2fc
1 changed files with 20 additions and 1 deletions
21
demo.ipynb
21
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']}\")"
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue