Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,11 @@ import gradio as gr
|
|
5 |
from concurrent.futures import ThreadPoolExecutor
|
6 |
from zipfile import ZipFile
|
7 |
|
|
|
|
|
8 |
def get_image_ids(batch_id: str) -> list[str]:
|
9 |
"""A list of image IDs in the given batch"""
|
10 |
-
response = requests.get(f"
|
11 |
response.raise_for_status()
|
12 |
response = response.json()
|
13 |
return [item["id"].split("!")[1][:14] for item in response["items"]]
|
@@ -34,7 +36,7 @@ def download_image_by_image_id(image_id: str):
|
|
34 |
"""
|
35 |
batch_id = image_id[:8]
|
36 |
os.makedirs(batch_id, exist_ok=True)
|
37 |
-
url = f"
|
38 |
dest = os.path.join(batch_id, image_id + ".jpg")
|
39 |
download_image(url, dest)
|
40 |
|
|
|
5 |
from concurrent.futures import ThreadPoolExecutor
|
6 |
from zipfile import ZipFile
|
7 |
|
8 |
+
IIIF_URL = "https://lbiiif.riksarkivet.se" #"https://iiifintern.ra.se"
|
9 |
+
|
10 |
def get_image_ids(batch_id: str) -> list[str]:
|
11 |
"""A list of image IDs in the given batch"""
|
12 |
+
response = requests.get(f"{IIIF_URL}/arkis!{batch_id}/manifest")
|
13 |
response.raise_for_status()
|
14 |
response = response.json()
|
15 |
return [item["id"].split("!")[1][:14] for item in response["items"]]
|
|
|
36 |
"""
|
37 |
batch_id = image_id[:8]
|
38 |
os.makedirs(batch_id, exist_ok=True)
|
39 |
+
url = f"{IIIF_URL}/arkis!{image_id}/full/max/0/default.jpg"
|
40 |
dest = os.path.join(batch_id, image_id + ".jpg")
|
41 |
download_image(url, dest)
|
42 |
|