Commit ·
ae5cc85
1
Parent(s): 7bcdc26
Update unsplash-image-text.py
Browse files- unsplash-image-text.py +5 -4
unsplash-image-text.py
CHANGED
|
@@ -13,8 +13,7 @@ year={2022}
|
|
| 13 |
"""
|
| 14 |
|
| 15 |
_DESCRIPTION = """\
|
| 16 |
-
This is a dataset that streams photos data from the Unsplash 25K servers
|
| 17 |
-
and reformats for multimodal use-cases.
|
| 18 |
"""
|
| 19 |
_HOMEPAGE = "https://github.com/unsplash/datasets/"
|
| 20 |
|
|
@@ -22,6 +21,8 @@ _LICENSE = ""
|
|
| 22 |
|
| 23 |
_URL = "https://unsplash.com/data/lite/latest"
|
| 24 |
|
|
|
|
|
|
|
| 25 |
_COLS = [
|
| 26 |
'photo_id',
|
| 27 |
'photo_url',
|
|
@@ -62,8 +63,8 @@ class Unsplash(datasets.GeneratorBasedBuilder):
|
|
| 62 |
if file not in ['photos.tsv000', 'url.json']:
|
| 63 |
os.remove(new_url+'/'+file)
|
| 64 |
# load URLs
|
| 65 |
-
|
| 66 |
-
|
| 67 |
# format into dataframe
|
| 68 |
keys = list(urls.keys())
|
| 69 |
values = list(urls.values())
|
|
|
|
| 13 |
"""
|
| 14 |
|
| 15 |
_DESCRIPTION = """\
|
| 16 |
+
This is a dataset that streams photos data from the Unsplash 25K servers.
|
|
|
|
| 17 |
"""
|
| 18 |
_HOMEPAGE = "https://github.com/unsplash/datasets/"
|
| 19 |
|
|
|
|
| 21 |
|
| 22 |
_URL = "https://unsplash.com/data/lite/latest"
|
| 23 |
|
| 24 |
+
URL_JSON = "https://huggingface.co/datasets/jamescalam/unsplash-image-text/raw/main/url.json"
|
| 25 |
+
|
| 26 |
_COLS = [
|
| 27 |
'photo_id',
|
| 28 |
'photo_url',
|
|
|
|
| 63 |
if file not in ['photos.tsv000', 'url.json']:
|
| 64 |
os.remove(new_url+'/'+file)
|
| 65 |
# load URLs
|
| 66 |
+
res = requests.get(URL_JSON)
|
| 67 |
+
urls = json.loads(res.text)
|
| 68 |
# format into dataframe
|
| 69 |
keys = list(urls.keys())
|
| 70 |
values = list(urls.values())
|