Spaces:
Running
Running
Update app.py
Browse files
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(
|
|
|
|
|
|
|
|
|
|
|
128 |
with gr.Row(): # 两列布局
|
129 |
-
with gr.
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
examples=
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
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")
|