Spaces:
Running on Zero

HwwwH commited on
Commit
ea53409
·
verified ·
1 Parent(s): 594b93e

Align the language and display controls in two equal columns

Browse files
Files changed (2) hide show
  1. __pycache__/app.cpython-312.pyc +0 -0
  2. app.py +16 -17
__pycache__/app.cpython-312.pyc CHANGED
Binary files a/__pycache__/app.cpython-312.pyc and b/__pycache__/app.cpython-312.pyc differ
 
app.py CHANGED
@@ -114,6 +114,9 @@ COPY = {
114
  },
115
  }
116
  RESULT_CSS = """
 
 
 
117
  .ocr-result table { border-collapse: collapse; width: 100%; margin: 8px 0; }
118
  .ocr-result td, .ocr-result th { border: 1px solid #d1d5db; padding: 4px 8px; vertical-align: top; }
119
  """
@@ -367,30 +370,26 @@ if os.environ.get("OCR_SKIP_LAUNCH") != "1":
367
 
368
  with gr.Blocks(title="MiniCPM-OCR") as demo:
369
  intro = gr.Markdown(english["intro"])
370
- with gr.Row():
371
- language = gr.Radio(
372
- choices=[("English", "en"), ("中文", "zh")],
373
- value="en",
374
- label=english["language_label"],
375
- scale=0,
376
- min_width=220,
377
- )
378
- with gr.Row():
379
- with gr.Column():
380
  image = gr.Image(type="pil", label=english["image"], placeholder=english["upload"])
381
- upright = gr.Checkbox(label=english["upright"], info=english["upright_info"], value=True)
382
- recognize_seal = gr.Checkbox(label=english["seal"], info=english["seal_info"], value=True)
383
- recognize_chart = gr.Checkbox(label=english["chart"], info=english["chart_info"], value=True)
 
384
  button = gr.Button(english["parse"], variant="primary")
385
- with gr.Column():
386
- progress = gr.HTML()
387
  view = gr.Radio(
388
  choices=[(english["rendered"], "rendered"), (english["source"], "source")],
389
  value="rendered",
390
  label=english["view_label"],
391
- scale=0,
392
- min_width=220,
393
  )
 
394
  markdown = gr.Markdown(
395
  elem_classes=["ocr-result"],
396
  sanitize_html=False,
 
114
  },
115
  }
116
  RESULT_CSS = """
117
+ .ocr-columns { align-items: flex-start !important; gap: 16px; }
118
+ .ocr-columns > .column { flex: 1 1 0 !important; min-width: 0 !important; width: calc(50% - 8px) !important; }
119
+ .ocr-col > .block, .ocr-col > .form { width: 100% !important; }
120
  .ocr-result table { border-collapse: collapse; width: 100%; margin: 8px 0; }
121
  .ocr-result td, .ocr-result th { border: 1px solid #d1d5db; padding: 4px 8px; vertical-align: top; }
122
  """
 
370
 
371
  with gr.Blocks(title="MiniCPM-OCR") as demo:
372
  intro = gr.Markdown(english["intro"])
373
+ with gr.Row(elem_classes=["ocr-columns"]):
374
+ with gr.Column(elem_classes=["ocr-col"], scale=1, min_width=0):
375
+ language = gr.Radio(
376
+ choices=[("English", "en"), ("中文", "zh")],
377
+ value="en",
378
+ label=english["language_label"],
379
+ )
 
 
 
380
  image = gr.Image(type="pil", label=english["image"], placeholder=english["upload"])
381
+ with gr.Group():
382
+ upright = gr.Checkbox(label=english["upright"], info=english["upright_info"], value=True)
383
+ recognize_seal = gr.Checkbox(label=english["seal"], info=english["seal_info"], value=True)
384
+ recognize_chart = gr.Checkbox(label=english["chart"], info=english["chart_info"], value=True)
385
  button = gr.Button(english["parse"], variant="primary")
386
+ with gr.Column(elem_classes=["ocr-col"], scale=1, min_width=0):
 
387
  view = gr.Radio(
388
  choices=[(english["rendered"], "rendered"), (english["source"], "source")],
389
  value="rendered",
390
  label=english["view_label"],
 
 
391
  )
392
+ progress = gr.HTML()
393
  markdown = gr.Markdown(
394
  elem_classes=["ocr-result"],
395
  sanitize_html=False,