Difficulty accessing downloaded datasets on huggingface space


I am trying to build a gradio application on huggingface space using docker. It basically downloads a dataset from huggingface repo and then access it from cache directory. Now I am lost about how to access the dataset in cache on hugging face space.

Following the code snippet which tries to access it…

dataset = load_dataset(“xyz/dataset”)
json_mapping_dir = “/Users/xyz/.cache/huggingface/datasets/downloads”
audio_data_list =
for example in dataset[“train”][“audio”]:
path =example[“path”]
id = path.split(“/”)[-1]
json_file_path = f"{json_mapping_dir}/{id}.json"

# Load the mapping from the JSON file
with open(json_file_path, "r") as json_file:
    mapping_data = json.load(json_file)

This path json_mapping_dir is from my local machine. How to customise it according to the docker running on huggingface space.