Joker1212 commited on
Commit
c887e15
·
verified ·
1 Parent(s): 9e87980

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -23
app.py CHANGED
@@ -124,30 +124,36 @@ def main():
124
  det_models_labels = list(det_model_dir.keys())
125
  rec_models_labels = list(rec_model_dir.keys())
126
 
127
- with gr.Blocks() as demo:
 
 
 
 
 
128
  with gr.Row(): # 两列布局
129
- with gr.Column(variant="panel"): # 左边列
130
- img_input = gr.Image(label="Upload or Select Image", sources="upload")
131
-
132
- # 示例图片选择器
133
- examples = gr.Examples(
134
- examples=example_images,
135
- inputs=img_input,
136
- fn=lambda x: x, # 简单返回图片路径
137
- outputs=img_input,
138
- cache_examples=True
139
- )
140
-
141
- table_engine_type = gr.Dropdown(table_engine_list, label="Select Table Recognition Engine",
142
- value=table_engine_list[0])
143
- det_model = gr.Dropdown(det_models_labels, label="Select OCR Detection Model",
144
- value=det_models_labels[0])
145
- rec_model = gr.Dropdown(rec_models_labels, label="Select OCR Recognition Model",
146
- value=rec_models_labels[0])
147
-
148
- run_button = gr.Button("Run")
149
- gr.Markdown("# Elapsed Time")
150
- elapse_text = gr.Text(label="") # 使用 `gr.Text` 组件展示字符串
 
151
  with gr.Column(scale=2): # 右边列
152
  # 使用 Markdown 标题分隔各个组件
153
  gr.Markdown("# Html Render")
 
124
  det_models_labels = list(det_model_dir.keys())
125
  rec_models_labels = list(rec_model_dir.keys())
126
 
127
+ with gr.Blocks(css="""
128
+ .scrollable-container {
129
+ overflow-x: auto;
130
+ white-space: nowrap;
131
+ }
132
+ """) as demo:
133
  with gr.Row(): # 两列布局
134
+ with gr.Tab("Options"):
135
+ with gr.Column(variant="panel", scale=1): # 侧边栏,宽度比例为1
136
+ img_input = gr.Image(label="Upload or Select Image", sources="upload", value="images/lineless3.jpg")
137
+
138
+ # 示例图片选择器
139
+ examples = gr.Examples(
140
+ examples=example_images,
141
+ inputs=img_input,
142
+ fn=lambda x: x, # 简单返回图片路径
143
+ outputs=img_input,
144
+ cache_examples=True
145
+ )
146
+
147
+ table_engine_type = gr.Dropdown(table_engine_list, label="Select Recognition Table Engine",
148
+ value=table_engine_list[0])
149
+ det_model = gr.Dropdown(det_models_labels, label="Select OCR Detection Model",
150
+ value=det_models_labels[0])
151
+ rec_model = gr.Dropdown(rec_models_labels, label="Select OCR Recognition Model",
152
+ value=rec_models_labels[0])
153
+
154
+ run_button = gr.Button("Run")
155
+ gr.Markdown("# Elapsed Time")
156
+ elapse_text = gr.Text(label="") # 使用 `gr.Text` 组件展示字符串
157
  with gr.Column(scale=2): # 右边列
158
  # 使用 Markdown 标题分隔各个组件
159
  gr.Markdown("# Html Render")