Skip to content

Commit f0efd37

Browse files
authored
Merge pull request #2079 from hackforla/ssiegal.2078
2078: create the current year repo on Huggingface
2 parents 2078790 + ad15dde commit f0efd37

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,19 @@ brew install act
8585

8686
```bash
8787
act -j run --verbose
88+
```
8889

8990
Use the verbose flag, at least the first time, since the image downloads take so long
9091

92+
## Run the HuggingFace update script locally via Python
93+
94+
```bash
95+
export HUGGINGFACE_LOGIN_TOKEN=<xxx>
96+
export VITE_ENV=DEV
97+
cd src/scripts
98+
python updateHfDataset.py
99+
```
100+
91101
### Information About Technologies
92102

93103
- Frontend

src/scripts/updateHfDataset.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ def hfUpload(year=None):
102102

103103
login(TOKEN)
104104
api = HfApi()
105+
106+
# If the current year's repo doesn't exist, create it
107+
# the exist_ok=True flag means we'll ignore any errors if it already exists
108+
url = api.create_repo(
109+
repo_id=repo_id,
110+
token=TOKEN,
111+
private=False,
112+
repo_type="dataset",
113+
exist_ok=True,
114+
)
115+
105116
api.upload_file(
106117
path_or_fileobj=local_filename,
107118
path_in_repo=dest_filename,

0 commit comments

Comments
 (0)