Hide CSV files on Spaces
Is there a way to hide csv files on Spaces to prevent users from being able to download them? I’m aware you can add secrets but that doesn’t seem to cover files?
2023-03-09T07:46:19Z
Hi@bradley6597, here’s a quick trick to get protected files on a public SpaceCreate a new dataset/modelUse thehuggingface_hublibrary to clone the dataset/model on the path you’re running the script fromDont forget to add the secretHUGGING_FACE_HUB_TOKENto your Space secrets soRepositorycan authenticatetoken=True, you can also pass the token e.gtoken=os.environ["HUB_TOKEN"]examplefrom huggingface_hub import Repository

repo = Repository(
    local_dir="secret-csvs",
    repo_type="dataset",
    clone_from="radames/secret-csvs",
    token=True
)
repo.git_pull()Now you can read you files from thesecret-csvsfolder
2023-03-09T09:09:15Z
radames:Use thehuggingface_hublibrary to clone the dataset/model on the path you’re running the script fromThanks@radames!I ended up following the same principles and used this code insteadfrom datasets import load_dataset
from huggingface_hub import login

login(token = os.environ['HUB_TOKEN'])
dataset = load_dataset("hugging/face/path")
2023-04-11T09:14:23Z
radames:Hi@bradley6597, here’s a quick trick to get protected files on a public SpaceI’m a new fan of HF and I had a similar problem if I wanted to import a utils.py file from private Space. How should I operate it?
2023-04-11T14:27:45Z
Hi@JunchuanYu! The code snippet shared above@radamesshould work for your use case as well. But since you only have one file, I think you can use REDACTED_TOKEN_download in yourapp.py.huggingface.coDownload files from the HubWe’re on a journey to advance and democratize artificial intelligence through open source and open science.
2023-04-17T10:11:12Z
Hey@freddyaboulton, how would you then call functions within the file after using REDACTED_TOKEN_download as it’s in the cache?