Spaces:
Running
on
Zero
Running
on
Zero
viklofg
commited on
Commit
·
ea493bd
1
Parent(s):
b7d87d9
Update submission by image ID
Browse files- app/tabs/submit.py +15 -11
app/tabs/submit.py
CHANGED
@@ -173,6 +173,13 @@ def get_selected_example_pipeline(event: gr.SelectData) -> str | None:
|
|
173 |
return name
|
174 |
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
with gr.Blocks() as submit:
|
177 |
gr.Markdown("# Upload")
|
178 |
gr.Markdown("Select or upload the image you want to transcribe. You can upload up to five images at a time.")
|
@@ -199,14 +206,16 @@ with gr.Blocks() as submit:
|
|
199 |
min_width=250,
|
200 |
)
|
201 |
|
202 |
-
|
203 |
-
label="
|
204 |
-
info=
|
|
|
|
|
|
|
|
|
205 |
placeholder="R0002231_00005",
|
206 |
)
|
207 |
|
208 |
-
iiif_image_placeholder = gr.Image(visible=False)
|
209 |
-
|
210 |
gr.Markdown("## Settings")
|
211 |
gr.Markdown("Select a pipeline that suits your image. You can edit the pipeline if you need to customize it further.")
|
212 |
|
@@ -261,12 +270,7 @@ with gr.Blocks() as submit:
|
|
261 |
return gr.update(value=None)
|
262 |
return images
|
263 |
|
264 |
-
|
265 |
-
return f"https://lbiiif.riksarkivet.se/arkis!{image_iiif_url}/full/max/0/default.jpg"
|
266 |
-
|
267 |
-
image_iiif_url.submit(fn=return_iiif_url, inputs=image_iiif_url, outputs=iiif_image_placeholder).then(
|
268 |
-
fn=lambda x: [x], inputs=iiif_image_placeholder, outputs=batch_image_gallery
|
269 |
-
)
|
270 |
|
271 |
run_button.click(
|
272 |
lambda: gr.update(visible=True),
|
|
|
173 |
return name
|
174 |
|
175 |
|
176 |
+
def get_image_from_image_id(image_id):
|
177 |
+
"""
|
178 |
+
Get URL of submitted image ID.
|
179 |
+
"""
|
180 |
+
return [f"https://lbiiif.riksarkivet.se/arkis!{image_id}/full/max/0/default.jpg"]
|
181 |
+
|
182 |
+
|
183 |
with gr.Blocks() as submit:
|
184 |
gr.Markdown("# Upload")
|
185 |
gr.Markdown("Select or upload the image you want to transcribe. You can upload up to five images at a time.")
|
|
|
206 |
min_width=250,
|
207 |
)
|
208 |
|
209 |
+
image_id = gr.Textbox(
|
210 |
+
label="Upload by image ID",
|
211 |
+
info=(
|
212 |
+
"Use any image from our digitized archives by pasting its image ID found in the "
|
213 |
+
"<a href='https://sok.riksarkivet.se/bildvisning/R0002231_00005' target='_blank'>image viewer</a>. "
|
214 |
+
"Press enter to submit."
|
215 |
+
),
|
216 |
placeholder="R0002231_00005",
|
217 |
)
|
218 |
|
|
|
|
|
219 |
gr.Markdown("## Settings")
|
220 |
gr.Markdown("Select a pipeline that suits your image. You can edit the pipeline if you need to customize it further.")
|
221 |
|
|
|
270 |
return gr.update(value=None)
|
271 |
return images
|
272 |
|
273 |
+
image_id.submit(fn=get_image_from_image_id, inputs=image_id, outputs=batch_image_gallery)
|
|
|
|
|
|
|
|
|
|
|
274 |
|
275 |
run_button.click(
|
276 |
lambda: gr.update(visible=True),
|