lhoestq HF staff commited on
Commit
4027e25
1 Parent(s): 784f684

Fix dataset preview

Browse files

To fix the preview, the dataset must work in streaming mode. It's not working right now because `new_url + "/file"` is not the correct way to point to a file in an online ZIP file.
We use chained URLs in streaming mode, they look like this: `zip://path/to/file::https://foo.bar/data.zip`

We extended functions like `os.path.join` to support chained URLs, therefore you can just use `os.path.join` instead. It joins the inner path inside the ZIP archive instead of appending to the URL.

Files changed (1) hide show
  1. unsplash-25k-photos.py +1 -1
unsplash-25k-photos.py CHANGED
@@ -74,7 +74,7 @@ class Unsplash(datasets.GeneratorBasedBuilder):
74
  return [
75
  datasets.SplitGenerator(
76
  name=datasets.Split.TRAIN,
77
- gen_kwargs={"filepath": new_url+"/photos.tsv000"}
78
  ),
79
  ]
80
 
 
74
  return [
75
  datasets.SplitGenerator(
76
  name=datasets.Split.TRAIN,
77
+ gen_kwargs={"filepath": os.path.join(new_url, "photos.tsv000")}
78
  ),
79
  ]
80