patrickvonplaten commited on
Commit
6ac707e
1 Parent(s): 5503434

Update common_voice.py (#4212)

Browse files

Commit from https://github.com/huggingface/datasets/commit/8c826fb80f7f8135f6e632d34c8f59134f5983c8

Files changed (1) hide show
  1. common_voice.py +2 -1
common_voice.py CHANGED
@@ -792,8 +792,9 @@ class CommonVoice(datasets.GeneratorBasedBuilder):
792
  result = {key: value for key, value in zip(data_fields, field_values)}
793
 
794
  # set audio feature
 
795
  result["audio"] = {"path": path, "bytes": f.read()}
796
  # set path to None if the audio file doesn't exist locally (i.e. in streaming mode)
797
- result["path"] = os.path.join(local_extracted_archive, path) if local_extracted_archive else None
798
 
799
  yield path, result
 
792
  result = {key: value for key, value in zip(data_fields, field_values)}
793
 
794
  # set audio feature
795
+ path = os.path.join(local_extracted_archive, path) if local_extracted_archive else path
796
  result["audio"] = {"path": path, "bytes": f.read()}
797
  # set path to None if the audio file doesn't exist locally (i.e. in streaming mode)
798
+ result["path"] = path if local_extracted_archive else None
799
 
800
  yield path, result