userstudy / test_download.py
Wenjiawang0312
store
1618b8d
raw
history blame contribute delete
783 Bytes
#!/usr/bin/env python3
"""
测试视频下载
"""
from huggingface_hub import hf_hub_download
REPO_ID = "WenjiaWang/videoforuser"
# 测试下载一个视频
test_video = "0O_YyxcC-kA_scene-35_2/gen3c.mp4"
print(f"测试下载: {test_video}")
try:
local_path = hf_hub_download(
repo_id=REPO_ID,
filename=test_video,
repo_type="dataset"
)
print(f"✓ 下载成功: {local_path}")
# 检查文件是否存在
import os
if os.path.exists(local_path):
file_size = os.path.getsize(local_path)
print(f"✓ 文件存在,大小: {file_size / 1024:.2f} KB")
else:
print("✗ 文件不存在")
except Exception as e:
print(f"✗ 下载失败: {e}")
import traceback
traceback.print_exc()