Spaces:
Paused
Paused
UI: Move the provider from config tab to upload and convert tab
Browse files- src/ui/ui.py +30 -23
src/ui/ui.py
CHANGED
|
@@ -135,6 +135,11 @@ def create_ui():
|
|
| 135 |
gap: 10px;
|
| 136 |
margin-top: 10px;
|
| 137 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
""") as demo:
|
| 139 |
gr.Markdown("Markit: Convert any documents to Markdown")
|
| 140 |
|
|
@@ -145,6 +150,30 @@ def create_ui():
|
|
| 145 |
|
| 146 |
with gr.Tabs():
|
| 147 |
with gr.Tab("Upload and Convert"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
file_input = gr.File(label="Upload PDF", type="filepath")
|
| 149 |
|
| 150 |
# Simple output container with just one scrollbar
|
|
@@ -160,30 +189,8 @@ def create_ui():
|
|
| 160 |
convert_button = gr.Button("Convert", variant="primary")
|
| 161 |
cancel_button = gr.Button("Cancel", variant="stop", visible=False)
|
| 162 |
|
| 163 |
-
with gr.Tab("
|
| 164 |
with gr.Group(elem_classes=["settings-group"]):
|
| 165 |
-
with gr.Row():
|
| 166 |
-
with gr.Column(scale=1):
|
| 167 |
-
parser_names = ParserRegistry.get_parser_names()
|
| 168 |
-
default_parser = parser_names[0] if parser_names else "PyPdfium"
|
| 169 |
-
|
| 170 |
-
provider_dropdown = gr.Dropdown(
|
| 171 |
-
label="Provider",
|
| 172 |
-
choices=parser_names,
|
| 173 |
-
value=default_parser,
|
| 174 |
-
interactive=True
|
| 175 |
-
)
|
| 176 |
-
with gr.Column(scale=1):
|
| 177 |
-
default_ocr_options = ParserRegistry.get_ocr_options(default_parser)
|
| 178 |
-
default_ocr = default_ocr_options[0] if default_ocr_options else "No OCR"
|
| 179 |
-
|
| 180 |
-
ocr_dropdown = gr.Dropdown(
|
| 181 |
-
label="OCR Options",
|
| 182 |
-
choices=default_ocr_options,
|
| 183 |
-
value=default_ocr,
|
| 184 |
-
interactive=True
|
| 185 |
-
)
|
| 186 |
-
|
| 187 |
output_format = gr.Radio(
|
| 188 |
label="Output Format",
|
| 189 |
choices=["Markdown", "JSON", "Text", "Document Tags"],
|
|
|
|
| 135 |
gap: 10px;
|
| 136 |
margin-top: 10px;
|
| 137 |
}
|
| 138 |
+
|
| 139 |
+
/* Add margin below the provider/OCR options row */
|
| 140 |
+
.provider-options-row {
|
| 141 |
+
margin-bottom: 15px;
|
| 142 |
+
}
|
| 143 |
""") as demo:
|
| 144 |
gr.Markdown("Markit: Convert any documents to Markdown")
|
| 145 |
|
|
|
|
| 150 |
|
| 151 |
with gr.Tabs():
|
| 152 |
with gr.Tab("Upload and Convert"):
|
| 153 |
+
# Provider and OCR options moved from Config tab to here
|
| 154 |
+
gr.Markdown("**Conversion Options:** Select the document processing provider and OCR settings")
|
| 155 |
+
with gr.Row(elem_classes=["provider-options-row"]):
|
| 156 |
+
with gr.Column(scale=1):
|
| 157 |
+
parser_names = ParserRegistry.get_parser_names()
|
| 158 |
+
default_parser = parser_names[0] if parser_names else "PyPdfium"
|
| 159 |
+
|
| 160 |
+
provider_dropdown = gr.Dropdown(
|
| 161 |
+
label="Provider",
|
| 162 |
+
choices=parser_names,
|
| 163 |
+
value=default_parser,
|
| 164 |
+
interactive=True
|
| 165 |
+
)
|
| 166 |
+
with gr.Column(scale=1):
|
| 167 |
+
default_ocr_options = ParserRegistry.get_ocr_options(default_parser)
|
| 168 |
+
default_ocr = default_ocr_options[0] if default_ocr_options else "No OCR"
|
| 169 |
+
|
| 170 |
+
ocr_dropdown = gr.Dropdown(
|
| 171 |
+
label="OCR Options",
|
| 172 |
+
choices=default_ocr_options,
|
| 173 |
+
value=default_ocr,
|
| 174 |
+
interactive=True
|
| 175 |
+
)
|
| 176 |
+
|
| 177 |
file_input = gr.File(label="Upload PDF", type="filepath")
|
| 178 |
|
| 179 |
# Simple output container with just one scrollbar
|
|
|
|
| 189 |
convert_button = gr.Button("Convert", variant="primary")
|
| 190 |
cancel_button = gr.Button("Cancel", variant="stop", visible=False)
|
| 191 |
|
| 192 |
+
with gr.Tab("Output Format"):
|
| 193 |
with gr.Group(elem_classes=["settings-group"]):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
output_format = gr.Radio(
|
| 195 |
label="Output Format",
|
| 196 |
choices=["Markdown", "JSON", "Text", "Document Tags"],
|