viklofg commited on
Commit
4846384
·
1 Parent(s): 5f891d2

Update styling of image input widget

Browse files
Files changed (2) hide show
  1. app/gradio_config.py +1 -9
  2. app/tabs/submit.py +58 -57
app/gradio_config.py CHANGED
@@ -50,7 +50,7 @@ hr.region-divider {
50
  margin-bottom: 0.5em;
51
  }
52
 
53
- .pipeline-panel {
54
  background: none;
55
  border: solid 1px;
56
  border-color: var(--block-border-color);
@@ -120,12 +120,4 @@ height: auto !important;
120
  display:block;
121
  }
122
 
123
- .image_tab {
124
- background: var(--bg);
125
- border: none;
126
- }
127
-
128
- .image_tabs {
129
- background: var(--bg);
130
- }
131
  """
 
50
  margin-bottom: 0.5em;
51
  }
52
 
53
+ .panel-with-border {
54
  background: none;
55
  border: solid 1px;
56
  border-color: var(--block-border-color);
 
120
  display:block;
121
  }
122
 
 
 
 
 
 
 
 
 
123
  """
app/tabs/submit.py CHANGED
@@ -201,64 +201,65 @@ with gr.Blocks() as submit:
201
 
202
  collection_submit_state = gr.State()
203
 
204
- with gr.Group():
205
- with gr.Row(equal_height=True):
206
- with gr.Column(scale=2):
207
- batch_image_gallery = gr.Gallery(
208
- file_types=["image"],
209
- label="Image to transcribe",
210
- interactive=True,
211
- object_fit="scale-down",
212
- )
213
 
214
- with gr.Column(scale=1):
215
- with gr.Tabs(elem_classes="image_tabs"):
216
- with gr.Tab("Examples", elem_classes="image_tab"):
217
- examples = gr.Gallery(
218
- all_example_images(),
219
- show_label=False,
220
- interactive=False,
221
- allow_preview=False,
222
- object_fit="scale-down",
223
- min_width=250,
224
- height="100%",
225
- columns=4,
226
- )
227
-
228
- with gr.Tab("Image ID", elem_classes="image_tab"):
229
- image_id = gr.Textbox(
230
- label="Upload by image ID",
231
- info=(
232
- "Use any image from our digitized archives by pasting its image ID found in the "
233
- "<a href='https://sok.riksarkivet.se/bildvisning/R0002231_00005' target='_blank'>image viewer</a>. "
234
- "Press enter to submit."
235
- ),
236
- placeholder="R0002231_00005",
237
- )
238
-
239
- with gr.Tab("IIIF Manifest", elem_classes="image_tab"):
240
- iiif_manifest_url = gr.Textbox(
241
- label="IIIF Manifest",
242
- info=(
243
- "Use an image from a IIIF manifest by pasting a IIIF manifest URL. "
244
- "Press enter to submit."
245
- ),
246
- placeholder="",
247
- )
248
- iiif_gallery = gr.Gallery(
249
- interactive=False,
250
- columns=4,
251
- allow_preview=False,
252
- container=False,
253
- show_label=False,
254
- object_fit="scale-down",
255
- )
256
-
257
- with gr.Tab("URL", elem_classes="image_tab"):
258
- image_url = gr.Textbox(label="Image URL", info="Upload an image by pasting its URL.", placeholder="https://example.com/image.jpg")
259
-
260
-
261
- with gr.Column(variant="panel", elem_classes="pipeline-panel"):
 
 
 
 
 
 
 
 
 
 
262
  gr.Markdown("## Settings")
263
  gr.Markdown(
264
  "Select a pipeline that best matches your image. The pipeline determines the processing workflow optimized for different handwritten text recognition tasks. "
 
201
 
202
  collection_submit_state = gr.State()
203
 
 
 
 
 
 
 
 
 
 
204
 
205
+ with gr.Row(equal_height=True):
206
+ with gr.Column(scale=2):
207
+ batch_image_gallery = gr.Gallery(
208
+ file_types=["image"],
209
+ label="Image to transcribe",
210
+ interactive=True,
211
+ object_fit="scale-down",
212
+ )
213
+
214
+ with gr.Column(scale=1, variant="panel", elem_classes="panel-with-border"):
215
+ with gr.Tabs():
216
+ with gr.Tab("Examples"):
217
+ examples = gr.Gallery(
218
+ all_example_images(),
219
+ show_label=False,
220
+ interactive=False,
221
+ allow_preview=False,
222
+ object_fit="scale-down",
223
+ min_width=250,
224
+ height="100%",
225
+ columns=4,
226
+ container=False,
227
+ )
228
+
229
+ with gr.Tab("Image ID"):
230
+ image_id = gr.Textbox(
231
+ label="Upload by image ID",
232
+ info=(
233
+ "Use any image from our digitized archives by pasting its image ID found in the "
234
+ "<a href='https://sok.riksarkivet.se/bildvisning/R0002231_00005' target='_blank'>image viewer</a>. "
235
+ "Press enter to submit."
236
+ ),
237
+ placeholder="R0002231_00005",
238
+ )
239
+
240
+ with gr.Tab("IIIF Manifest"):
241
+ iiif_manifest_url = gr.Textbox(
242
+ label="IIIF Manifest",
243
+ info=(
244
+ "Use an image from a IIIF manifest by pasting a IIIF manifest URL. "
245
+ "Press enter to submit."
246
+ ),
247
+ placeholder="",
248
+ )
249
+ iiif_gallery = gr.Gallery(
250
+ interactive=False,
251
+ columns=4,
252
+ allow_preview=False,
253
+ container=False,
254
+ show_label=False,
255
+ object_fit="scale-down",
256
+ )
257
+
258
+ with gr.Tab("URL"):
259
+ image_url = gr.Textbox(label="Image URL", info="Upload an image by pasting its URL.", placeholder="https://example.com/image.jpg")
260
+
261
+
262
+ with gr.Column(variant="panel", elem_classes="panel-with-border"):
263
  gr.Markdown("## Settings")
264
  gr.Markdown(
265
  "Select a pipeline that best matches your image. The pipeline determines the processing workflow optimized for different handwritten text recognition tasks. "