Datasets:

Modalities:
Audio
Text
Formats:
parquet
Libraries:
Datasets
Dask

Parquet files doubt

#1
by gcjavi - opened

Hi! I am planning to post an ASR dataset on HuggingFace and I want to show a previsualization of the audio files along with the transcriptions in the dataviewer as you have in yours. I tried using some python scripts and I am not able to show both audio and text fields together. I saw that you only have a README and the parquet files. Could you explain me how did you generated the parquet files to properly show all the fields inlcuding the audio in the dataviewer? Thanks in advance!

CLASSLA - CLARIN Knowledge Centre for South Slavic Languages org

Hi! I think Dataset Viewer is disabled when data is loaded with a py script due to security concerns. I use a simple recipe for upload from my machine to the hub:

import datasets
import pandas as pd
TARGET_DATASET_NAME = "classla/demorepo"
df = pd.DataFrame(data={
    "audio": ["file1.wav", "file2.wav"], # Specification of paths to files
    "transcription": ["transcription of file 1", "and file 2"] # Transcriptions
})
ds = datasets.Dataset.from_pandas(df)
ds = ds.cast_column("audio", datasets.Audio(sampling_rate=16_000, mono=True)) # Reads the audio files in the 'audio' column
ds.push_to_hub(repo_id=TARGET_DATASET_NAME) # Upload.

You might need to first run

from huggingface_hub import login
login()

and follow the instructions to authentificate yourself.
I hope this snippet helps!

Hi! Thank you very much for the quick reply, it was exactly what I was searching for. Thanks again!

5roop changed discussion status to closed

Sign up or log in to comment