Spaces:
Sleeping
Sleeping
File size: 792 Bytes
2cd42be | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | from datasets import DatasetDict, Dataset
from dotenv import load_dotenv
import os
from huggingface_hub import HfApi
load_dotenv()
HF_DATA_REPO_ID = os.getenv("HF_DATA_REPO_ID")
HF_DATA_TOKEN = os.getenv("HF_DATA_TOKEN")
api = HfApi()
# 1๏ธโฃ repo ๋ด ์ ์ฒด ํ์ผ ๋ฆฌ์คํธ ๊ฐ์ ธ์ค๊ธฐ
files = api.list_repo_files(repo_id=HF_DATA_REPO_ID, repo_type="dataset", token=HF_DATA_TOKEN)
print(f"๐ ์ญ์ ๋์ ํ์ผ {len(files)}๊ฐ:")
for f in files:
print("-", f)
# 2๏ธโฃ ์ ์ฒด ํ์ผ ์ญ์
for path in files:
api.delete_file(
path_in_repo=path,
repo_id=HF_DATA_REPO_ID,
repo_type="dataset",
token=HF_DATA_TOKEN
)
print(f"๐๏ธ {path} ์ญ์ ์๋ฃ")
print("โ
ํ๊น
ํ์ด์ค Hub์ /data ํฌํจ ๋ชจ๋ ํ์ผ ์ญ์ ์๋ฃ") |