Gabriel commited on
Commit
d7f3fa0
1 Parent(s): a874957

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
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"https://iiifintern.ra.se/arkis!{batch_id}/manifest")
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"https://iiifintern.ra.se/arkis!{image_id}/full/max/0/default.jpg"
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