Commit
·
b7c6035
1
Parent(s):
417be40
Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,9 @@ from functools import lru_cache
|
|
10 |
from toolz import pluck
|
11 |
from piffle.image import IIIFImageClient
|
12 |
|
|
|
|
|
|
|
13 |
HF_MODEL_PATH = (
|
14 |
"ImageIN/levit-192_finetuned_on_unlabelled_IA_with_snorkel_labels"
|
15 |
)
|
@@ -36,9 +39,6 @@ def get_image_urls_from_manifest(data):
|
|
36 |
|
37 |
|
38 |
def resize_iiif_urls(image_url, size='224'):
|
39 |
-
# parts = im_url.split("/")
|
40 |
-
# parts[6] = f"{size}, {size}"
|
41 |
-
# return "/".join(parts)
|
42 |
image_url = IIIFImageClient.init_from_url(image_url)
|
43 |
image_url = image_url.size(width=size, height=size)
|
44 |
return image_url.__str__()
|
@@ -94,7 +94,7 @@ demo = gr.Interface(
|
|
94 |
inputs=gr.Text(label="IIIF manifest url"),
|
95 |
outputs=gallery,
|
96 |
title="IIIF book manifest illustration detection",
|
97 |
-
description=
|
98 |
examples=['https://iiif.lib.harvard.edu/manifests/drs:427603172',
|
99 |
"https://iiif.lib.harvard.edu/manifests/drs:427342693",
|
100 |
"https://iiif.archivelab.org/iiif/holylandbiblebok0000cunn/manifest.json"]
|
|
|
10 |
from toolz import pluck
|
11 |
from piffle.image import IIIFImageClient
|
12 |
|
13 |
+
|
14 |
+
DESCRIPTION = "# Identify illustrations in pages of historical books using their IIIF Manifest",
|
15 |
+
|
16 |
HF_MODEL_PATH = (
|
17 |
"ImageIN/levit-192_finetuned_on_unlabelled_IA_with_snorkel_labels"
|
18 |
)
|
|
|
39 |
|
40 |
|
41 |
def resize_iiif_urls(image_url, size='224'):
|
|
|
|
|
|
|
42 |
image_url = IIIFImageClient.init_from_url(image_url)
|
43 |
image_url = image_url.size(width=size, height=size)
|
44 |
return image_url.__str__()
|
|
|
94 |
inputs=gr.Text(label="IIIF manifest url"),
|
95 |
outputs=gallery,
|
96 |
title="IIIF book manifest illustration detection",
|
97 |
+
description=DESCRIPTION,
|
98 |
examples=['https://iiif.lib.harvard.edu/manifests/drs:427603172',
|
99 |
"https://iiif.lib.harvard.edu/manifests/drs:427342693",
|
100 |
"https://iiif.archivelab.org/iiif/holylandbiblebok0000cunn/manifest.json"]
|