Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,12 +4,12 @@ import shutil
|
|
4 |
shutil.move("repository.py", "/usr/local/lib/python3.10/site-packages/huggingface_hub/repository.py")
|
5 |
import gradio as gr
|
6 |
import random
|
7 |
-
from huggingface_hub import Repository
|
8 |
# from datasets import load_dataset
|
9 |
from datasets import config
|
10 |
|
11 |
hf_token = os.environ['hf_token'] # 确保环境变量中有你的令牌
|
12 |
-
submission_url =
|
13 |
local_dir = "VBench_sampled_video" # 本地文件夹路径
|
14 |
# dataset = load_dataset("Vchitect/VBench_sampled_video")
|
15 |
# print(os.listdir("~/.cache/huggingface/datasets/Vchitect___VBench_sampled_video/"))
|
@@ -28,10 +28,21 @@ def print_directory_contents(path, indent=0):
|
|
28 |
except PermissionError:
|
29 |
print(' ' * indent + "[权限错误,无法访问该目录]")
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
model_names = os.listdir(local_dir)
|
37 |
|
|
|
4 |
shutil.move("repository.py", "/usr/local/lib/python3.10/site-packages/huggingface_hub/repository.py")
|
5 |
import gradio as gr
|
6 |
import random
|
7 |
+
from huggingface_hub import Repository,HfApi
|
8 |
# from datasets import load_dataset
|
9 |
from datasets import config
|
10 |
|
11 |
hf_token = os.environ['hf_token'] # 确保环境变量中有你的令牌
|
12 |
+
submission_url = # 数据集的 URL
|
13 |
local_dir = "VBench_sampled_video" # 本地文件夹路径
|
14 |
# dataset = load_dataset("Vchitect/VBench_sampled_video")
|
15 |
# print(os.listdir("~/.cache/huggingface/datasets/Vchitect___VBench_sampled_video/"))
|
|
|
28 |
except PermissionError:
|
29 |
print(' ' * indent + "[权限错误,无法访问该目录]")
|
30 |
|
31 |
+
# 拉取数据集
|
32 |
+
os.makedirs(local_dir, exists_ok=True)
|
33 |
+
hf_api = HfApi(token=hf_token)
|
34 |
+
repo_id = "Vchitect/VBench_sampled_video"
|
35 |
+
dataset_files = api.list_repo_files(repo_id=repo_id, token=hf_token, repo_type='dataset')
|
36 |
|
37 |
+
for file in dataset_files:
|
38 |
+
print(file)
|
39 |
+
api.download_file(repo_id=repo_id, filename=file, token=hf_token,repo_type='dataset',cache_dir=local_dir)
|
40 |
+
|
41 |
+
# 下载数据集文件
|
42 |
+
for file in dataset_files:
|
43 |
+
api.download_file(repo_id=repo_id, filename=file, token=hf_token)
|
44 |
+
|
45 |
+
repo = HfApi(endpoint="https://huggingface.co", token=hf_token)
|
46 |
|
47 |
model_names = os.listdir(local_dir)
|
48 |
|