Update app.py
Browse files
app.py
CHANGED
|
@@ -378,28 +378,7 @@ def create_download_file(html_content):
|
|
| 378 |
|
| 379 |
|
| 380 |
# Create Gradio interface
|
| 381 |
-
with gr.Blocks(
|
| 382 |
-
title="PDF to HTML Converter",
|
| 383 |
-
css="""
|
| 384 |
-
.gradio-container {
|
| 385 |
-
max-width: 1200px !important;
|
| 386 |
-
}
|
| 387 |
-
#html_preview {
|
| 388 |
-
min-height: 600px;
|
| 389 |
-
max-height: 800px;
|
| 390 |
-
overflow-y: auto;
|
| 391 |
-
border: 1px solid #e0e0e0;
|
| 392 |
-
border-radius: 8px;
|
| 393 |
-
padding: 20px;
|
| 394 |
-
background: white;
|
| 395 |
-
}
|
| 396 |
-
#html_source {
|
| 397 |
-
font-family: 'Courier New', monospace;
|
| 398 |
-
font-size: 13px;
|
| 399 |
-
line-height: 1.5;
|
| 400 |
-
}
|
| 401 |
-
"""
|
| 402 |
-
) as demo:
|
| 403 |
|
| 404 |
gr.Markdown(
|
| 405 |
"""
|
|
@@ -415,14 +394,10 @@ with gr.Blocks(
|
|
| 415 |
with gr.Column(scale=4):
|
| 416 |
pdf_url_input = gr.Textbox(
|
| 417 |
label="PDF URL",
|
| 418 |
-
placeholder="https://example.com/document.pdf"
|
| 419 |
-
lines=1
|
| 420 |
)
|
| 421 |
with gr.Column(scale=1):
|
| 422 |
-
process_btn = gr.Button(
|
| 423 |
-
"π Process PDF",
|
| 424 |
-
variant="primary"
|
| 425 |
-
)
|
| 426 |
|
| 427 |
summary_output = gr.Markdown(label="Summary")
|
| 428 |
|
|
@@ -430,19 +405,14 @@ with gr.Blocks(
|
|
| 430 |
|
| 431 |
with gr.Tabs():
|
| 432 |
with gr.Tab("π HTML Preview"):
|
| 433 |
-
html_preview = gr.HTML(
|
| 434 |
-
label="Rendered HTML",
|
| 435 |
-
elem_id="html_preview"
|
| 436 |
-
)
|
| 437 |
|
| 438 |
with gr.Tab("π» HTML Source"):
|
| 439 |
html_source = gr.Code(
|
| 440 |
label="HTML Source Code",
|
| 441 |
-
language="html"
|
| 442 |
-
lines=25,
|
| 443 |
-
elem_id="html_source"
|
| 444 |
)
|
| 445 |
-
download_btn = gr.Button("π₯ Download HTML"
|
| 446 |
download_file = gr.File(label="Download", visible=False)
|
| 447 |
|
| 448 |
# Event handlers
|
|
|
|
| 378 |
|
| 379 |
|
| 380 |
# Create Gradio interface
|
| 381 |
+
with gr.Blocks(title="PDF to HTML Converter") as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 382 |
|
| 383 |
gr.Markdown(
|
| 384 |
"""
|
|
|
|
| 394 |
with gr.Column(scale=4):
|
| 395 |
pdf_url_input = gr.Textbox(
|
| 396 |
label="PDF URL",
|
| 397 |
+
placeholder="https://example.com/document.pdf"
|
|
|
|
| 398 |
)
|
| 399 |
with gr.Column(scale=1):
|
| 400 |
+
process_btn = gr.Button("π Process PDF", variant="primary")
|
|
|
|
|
|
|
|
|
|
| 401 |
|
| 402 |
summary_output = gr.Markdown(label="Summary")
|
| 403 |
|
|
|
|
| 405 |
|
| 406 |
with gr.Tabs():
|
| 407 |
with gr.Tab("π HTML Preview"):
|
| 408 |
+
html_preview = gr.HTML(label="Rendered HTML")
|
|
|
|
|
|
|
|
|
|
| 409 |
|
| 410 |
with gr.Tab("π» HTML Source"):
|
| 411 |
html_source = gr.Code(
|
| 412 |
label="HTML Source Code",
|
| 413 |
+
language="html"
|
|
|
|
|
|
|
| 414 |
)
|
| 415 |
+
download_btn = gr.Button("π₯ Download HTML")
|
| 416 |
download_file = gr.File(label="Download", visible=False)
|
| 417 |
|
| 418 |
# Event handlers
|