Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +2 -0
- collect-joka.py +71 -0
- images/museovirasto.000EDA88C0B0132D0F85A29EBE21A948.jpg +3 -0
- images/museovirasto.001EC19D16C4B29F0D23FCCEA95C1388.jpg +3 -0
- images/museovirasto.0083cc47-98b6-454a-a69e-f685c51b6386.jpg +3 -0
- images/museovirasto.008562ba-93cb-483a-ae93-1e42553979df.jpg +3 -0
- images/museovirasto.008F1483FD54A003708726A5B290262A.jpg +3 -0
- images/museovirasto.009C47F1042F8533171A6E20279FBC80.jpg +3 -0
- images/museovirasto.00c23216-3ccd-46bf-b5e1-448227a7afa4.jpg +3 -0
- images/museovirasto.00dbdd6c-9988-4674-b09c-00ae06f9da06.jpg +3 -0
- images/museovirasto.00ee6e60-f161-44a5-8654-91d82e48bba1.jpg +3 -0
- images/museovirasto.00f4ecc9-d2b9-41d9-9976-5fd2bea7843d.jpg +3 -0
- images/museovirasto.0101de29-0fad-44ad-acaa-25046279ffb5.jpg +3 -0
- images/museovirasto.0114b174-b79b-4b19-916f-206e032eedfe.jpg +3 -0
- images/museovirasto.011F3BD9DE0AFE97CC11494A47F8E4C5.jpg +3 -0
- images/museovirasto.011FA86ABC9D44FC4DB37736E3737D2C.jpg +3 -0
- images/museovirasto.012e6ee8-f2f2-4dc0-880f-3b1ed378cc38.jpg +3 -0
- images/museovirasto.013cf866-84c5-4385-aa1a-c0aef7913347.jpg +3 -0
- images/museovirasto.01408990ECC604B19587E67B431A4287.jpg +3 -0
- images/museovirasto.01564e59-7669-45c7-8e4a-2a7ab011166a.jpg +3 -0
- images/museovirasto.01611ee6-2ac8-4a09-865f-5ebc0ad7c2d3.jpg +3 -0
- images/museovirasto.016591cb-8abd-4abc-b12d-e8d81c9a07ab.jpg +3 -0
- images/museovirasto.016f03cd-3b14-44f7-b168-b0b12dbfe49b.jpg +3 -0
- images/museovirasto.0190aa67-1d1b-4e15-be35-c4afc033a9f1.jpg +3 -0
- images/museovirasto.01F614816CFA253167ED6E618FB3A922.jpg +3 -0
- images/museovirasto.01a0d156-f2de-4b36-bdaa-fcdb0d351130.jpg +3 -0
- images/museovirasto.01dca5f8-ad0c-4c1d-93eb-1c9eb9884491.jpg +3 -0
- images/museovirasto.0206943CE7333CD75B80581E1A892612.jpg +3 -0
- images/museovirasto.02228084-f8b9-4fa5-ba1c-ec467f0aab99.jpg +3 -0
- images/museovirasto.0233784a-c60b-4dff-b7d5-ffb51f2a561b.jpg +3 -0
- images/museovirasto.023E55CAA4BDB7ABFA76367A7D372F3C.jpg +3 -0
- images/museovirasto.02513040-e1b2-45ea-ba9f-8037fb2dc298.jpg +3 -0
- images/museovirasto.026546BA4E80BC61EDE13C7DC724E2C1.jpg +3 -0
- images/museovirasto.027172C4BBF81EB74E82EB257B7A9610.jpg +3 -0
- images/museovirasto.02812884-9783-470c-be3a-f4ab8ecbae88.jpg +3 -0
- images/museovirasto.028afb59-f3f4-4143-af73-de79f5903673.jpg +3 -0
- images/museovirasto.02BB0C640C91C5BA29BF718CA625F671.jpg +3 -0
- images/museovirasto.02C776AEE2EF32AC5F83209EDC9D6C22.jpg +3 -0
- images/museovirasto.02D7444A1758C49243B108D5F62B368E.jpg +3 -0
- images/museovirasto.02b46aa7-5836-411d-8f19-1dbdaf164b45.jpg +3 -0
- images/museovirasto.02b5b642-e47d-44f0-90b0-aabb848105e2.jpg +3 -0
- images/museovirasto.02c53407-2b70-4677-808b-0bb3328e0eb5.jpg +3 -0
- images/museovirasto.02db51f4-fa63-459e-b540-32363b568fba.jpg +3 -0
- images/museovirasto.02f72c64-29e8-4e3c-904e-2a215b388f04.jpg +3 -0
- images/museovirasto.02fec68d-5d0a-490b-be4a-59b4b71a4a83.jpg +3 -0
- images/museovirasto.0301fea2-3a62-4915-8061-421f5f8d6b4f.jpg +3 -0
- images/museovirasto.030335544A133818FFB8D5DA8446E4F9.jpg +3 -0
- images/museovirasto.0307BF916434EEEC427BE161DA2C8F14.jpg +3 -0
- images/museovirasto.031BC01F939B6268786D3F6BFD03E051.jpg +3 -0
- images/museovirasto.033ffbbf-8f15-4cb6-8dbd-759bd4445b45.jpg +3 -0
.gitattributes
CHANGED
@@ -53,3 +53,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
56 |
+
joka-records.jsonl filter=lfs diff=lfs merge=lfs -text
|
57 |
+
metadata.jsonl filter=lfs diff=lfs merge=lfs -text
|
collect-joka.py
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
|
3 |
+
from finna_client import FinnaClient, IMAGE_BASE
|
4 |
+
import requests
|
5 |
+
import json
|
6 |
+
import os
|
7 |
+
import os.path
|
8 |
+
import logging
|
9 |
+
|
10 |
+
finna = FinnaClient()
|
11 |
+
logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.INFO)
|
12 |
+
|
13 |
+
MAX_YEAR = 1940 # retrieve only images older than this (inclusive)
|
14 |
+
IMAGE_DIR = 'images'
|
15 |
+
|
16 |
+
# Facet filters that define the set of images we want to
|
17 |
+
FILTERS = [
|
18 |
+
'~format_ext_str_mv:"0/Image/"', # Images
|
19 |
+
'~building:"0/Museovirasto/"', # from Museovirasto (Finnish Heritage Agency)
|
20 |
+
'~hierarchy_parent_title:"JOKA Journalistinen kuva-arkisto"', # JOKA archive
|
21 |
+
'~usage_rights_ext_str_mv:"0/B BY/"', # CC By license
|
22 |
+
f'search_daterange_mv:"overlap|[* TO {MAX_YEAR}]"', # date up to MAX_YEAR
|
23 |
+
]
|
24 |
+
|
25 |
+
# Fields to include in the metadata records
|
26 |
+
FIELDS = [
|
27 |
+
'formats',
|
28 |
+
'id',
|
29 |
+
'imageRights',
|
30 |
+
'images',
|
31 |
+
'languages',
|
32 |
+
'nonPresenterAuthors',
|
33 |
+
'onlineUrls',
|
34 |
+
'presenters',
|
35 |
+
'rating',
|
36 |
+
'series',
|
37 |
+
'subjects',
|
38 |
+
'title',
|
39 |
+
'year',
|
40 |
+
'rawData',
|
41 |
+
]
|
42 |
+
|
43 |
+
def download_url_to_file(url, filename):
|
44 |
+
if os.path.exists(filename) and os.stat(filename).st_size > 0:
|
45 |
+
return # file already exists, no need to re-download
|
46 |
+
with requests.get(url, stream=True) as r:
|
47 |
+
r.raise_for_status()
|
48 |
+
with open(filename, 'wb') as f:
|
49 |
+
for chunk in r.iter_content(chunk_size=8192):
|
50 |
+
f.write(chunk)
|
51 |
+
|
52 |
+
with open('metadata.jsonl', 'w') as outfile:
|
53 |
+
page = 1
|
54 |
+
|
55 |
+
while True:
|
56 |
+
logging.info(f'Loading result page {page}')
|
57 |
+
result = finna.search(filters=FILTERS, fields=FIELDS, page=page)
|
58 |
+
if 'records' not in result:
|
59 |
+
logging.info('No more records, stopping.')
|
60 |
+
break
|
61 |
+
logging.debug(f'Got {len(result["records"])} records')
|
62 |
+
for record in result['records']:
|
63 |
+
image_url = IMAGE_BASE + record['images'][0]
|
64 |
+
image_file_out = os.path.join(IMAGE_DIR, record['id'] + '.jpg')
|
65 |
+
download_url_to_file(image_url, image_file_out)
|
66 |
+
record['file_name'] = image_file_out
|
67 |
+
json.dump(record, outfile)
|
68 |
+
print("", file=outfile)
|
69 |
+
page += 1
|
70 |
+
|
71 |
+
|
images/museovirasto.000EDA88C0B0132D0F85A29EBE21A948.jpg
ADDED
Git LFS Details
|
images/museovirasto.001EC19D16C4B29F0D23FCCEA95C1388.jpg
ADDED
Git LFS Details
|
images/museovirasto.0083cc47-98b6-454a-a69e-f685c51b6386.jpg
ADDED
Git LFS Details
|
images/museovirasto.008562ba-93cb-483a-ae93-1e42553979df.jpg
ADDED
Git LFS Details
|
images/museovirasto.008F1483FD54A003708726A5B290262A.jpg
ADDED
Git LFS Details
|
images/museovirasto.009C47F1042F8533171A6E20279FBC80.jpg
ADDED
Git LFS Details
|
images/museovirasto.00c23216-3ccd-46bf-b5e1-448227a7afa4.jpg
ADDED
Git LFS Details
|
images/museovirasto.00dbdd6c-9988-4674-b09c-00ae06f9da06.jpg
ADDED
Git LFS Details
|
images/museovirasto.00ee6e60-f161-44a5-8654-91d82e48bba1.jpg
ADDED
Git LFS Details
|
images/museovirasto.00f4ecc9-d2b9-41d9-9976-5fd2bea7843d.jpg
ADDED
Git LFS Details
|
images/museovirasto.0101de29-0fad-44ad-acaa-25046279ffb5.jpg
ADDED
Git LFS Details
|
images/museovirasto.0114b174-b79b-4b19-916f-206e032eedfe.jpg
ADDED
Git LFS Details
|
images/museovirasto.011F3BD9DE0AFE97CC11494A47F8E4C5.jpg
ADDED
Git LFS Details
|
images/museovirasto.011FA86ABC9D44FC4DB37736E3737D2C.jpg
ADDED
Git LFS Details
|
images/museovirasto.012e6ee8-f2f2-4dc0-880f-3b1ed378cc38.jpg
ADDED
Git LFS Details
|
images/museovirasto.013cf866-84c5-4385-aa1a-c0aef7913347.jpg
ADDED
Git LFS Details
|
images/museovirasto.01408990ECC604B19587E67B431A4287.jpg
ADDED
Git LFS Details
|
images/museovirasto.01564e59-7669-45c7-8e4a-2a7ab011166a.jpg
ADDED
Git LFS Details
|
images/museovirasto.01611ee6-2ac8-4a09-865f-5ebc0ad7c2d3.jpg
ADDED
Git LFS Details
|
images/museovirasto.016591cb-8abd-4abc-b12d-e8d81c9a07ab.jpg
ADDED
Git LFS Details
|
images/museovirasto.016f03cd-3b14-44f7-b168-b0b12dbfe49b.jpg
ADDED
Git LFS Details
|
images/museovirasto.0190aa67-1d1b-4e15-be35-c4afc033a9f1.jpg
ADDED
Git LFS Details
|
images/museovirasto.01F614816CFA253167ED6E618FB3A922.jpg
ADDED
Git LFS Details
|
images/museovirasto.01a0d156-f2de-4b36-bdaa-fcdb0d351130.jpg
ADDED
Git LFS Details
|
images/museovirasto.01dca5f8-ad0c-4c1d-93eb-1c9eb9884491.jpg
ADDED
Git LFS Details
|
images/museovirasto.0206943CE7333CD75B80581E1A892612.jpg
ADDED
Git LFS Details
|
images/museovirasto.02228084-f8b9-4fa5-ba1c-ec467f0aab99.jpg
ADDED
Git LFS Details
|
images/museovirasto.0233784a-c60b-4dff-b7d5-ffb51f2a561b.jpg
ADDED
Git LFS Details
|
images/museovirasto.023E55CAA4BDB7ABFA76367A7D372F3C.jpg
ADDED
Git LFS Details
|
images/museovirasto.02513040-e1b2-45ea-ba9f-8037fb2dc298.jpg
ADDED
Git LFS Details
|
images/museovirasto.026546BA4E80BC61EDE13C7DC724E2C1.jpg
ADDED
Git LFS Details
|
images/museovirasto.027172C4BBF81EB74E82EB257B7A9610.jpg
ADDED
Git LFS Details
|
images/museovirasto.02812884-9783-470c-be3a-f4ab8ecbae88.jpg
ADDED
Git LFS Details
|
images/museovirasto.028afb59-f3f4-4143-af73-de79f5903673.jpg
ADDED
Git LFS Details
|
images/museovirasto.02BB0C640C91C5BA29BF718CA625F671.jpg
ADDED
Git LFS Details
|
images/museovirasto.02C776AEE2EF32AC5F83209EDC9D6C22.jpg
ADDED
Git LFS Details
|
images/museovirasto.02D7444A1758C49243B108D5F62B368E.jpg
ADDED
Git LFS Details
|
images/museovirasto.02b46aa7-5836-411d-8f19-1dbdaf164b45.jpg
ADDED
Git LFS Details
|
images/museovirasto.02b5b642-e47d-44f0-90b0-aabb848105e2.jpg
ADDED
Git LFS Details
|
images/museovirasto.02c53407-2b70-4677-808b-0bb3328e0eb5.jpg
ADDED
Git LFS Details
|
images/museovirasto.02db51f4-fa63-459e-b540-32363b568fba.jpg
ADDED
Git LFS Details
|
images/museovirasto.02f72c64-29e8-4e3c-904e-2a215b388f04.jpg
ADDED
Git LFS Details
|
images/museovirasto.02fec68d-5d0a-490b-be4a-59b4b71a4a83.jpg
ADDED
Git LFS Details
|
images/museovirasto.0301fea2-3a62-4915-8061-421f5f8d6b4f.jpg
ADDED
Git LFS Details
|
images/museovirasto.030335544A133818FFB8D5DA8446E4F9.jpg
ADDED
Git LFS Details
|
images/museovirasto.0307BF916434EEEC427BE161DA2C8F14.jpg
ADDED
Git LFS Details
|
images/museovirasto.031BC01F939B6268786D3F6BFD03E051.jpg
ADDED
Git LFS Details
|
images/museovirasto.033ffbbf-8f15-4cb6-8dbd-759bd4445b45.jpg
ADDED
Git LFS Details
|