File size: 704 Bytes
c0d911e |
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 30 31 32 33 34 |
import json
from pathlib import Path
from datasets import Dataset
from huggingface_hub import HfApi
ORG_NAME = "nlp-course"
def main():
"""Push quiz questions to the Hugging Face Hub"""
for file in Path("data").glob("*.json"):
print(f"Processing {file}")
with open(file, "r") as f:
quiz_data = json.load(f)
repo_id = f"{ORG_NAME}/{file.stem}_quiz"
dataset = Dataset.from_list(quiz_data)
print(f"Pushing {repo_id} to the Hugging Face Hub")
dataset.push_to_hub(
repo_id,
private=True,
commit_message=f"Update quiz questions for {file.stem}",
)
if __name__ == "__main__":
main()
|