File size: 781 Bytes
732843e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from huggingface_hub import HfApi
import glob, os

api = HfApi()
REPO = "OpenTransformer/web-crawl-2026"

files = []
for ext in ["*.py", "*.go", "*.rs", "*.sh", "*.mod", "*.sum", "*.toml"]:
    files.extend(glob.glob(f"/workspace/{ext}"))
files.extend(glob.glob("/workspace/rust_crawler/src/*.rs"))
files.append("/workspace/rust_crawler/Cargo.toml")
files = [f for f in files if os.path.isfile(f)]

print(f"Uploading {len(files)} source files to HF...")
for f in files:
    rel = os.path.relpath(f, "/workspace")
    hf_path = f"source/{rel}"
    try:
        api.upload_file(path_or_fileobj=f, path_in_repo=hf_path, repo_id=REPO, repo_type="dataset")
        print(f"  OK: {hf_path}")
    except Exception as e:
        print(f"  FAIL {hf_path}: {e}")
print("SOURCE UPLOAD DONE")