File size: 779 Bytes
e87b448
 
 
c99852b
 
e87b448
 
c99852b
 
 
e87b448
c99852b
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from draft_pipeline import process_document_pipeline

def process_document(doc_file):
    images, dictionaries, compiled_doc = process_document_pipeline(doc_file.name)
    return compiled_doc

with gr.Blocks() as demo:
    gr.Markdown("## 📚 Document Processing Pipeline")
    gr.Markdown("Upload a `.docx` file. It will be processed and a compiled document will be ready for download.")

    with gr.Row():
        input_file = gr.File(label="📄 Upload .docx Document", file_types=[".docx"])
        output_file = gr.File(label="⬇️ Download Processed Document")

    process_btn = gr.Button("🚀 Process Document")

    # Logic: when button is clicked
    process_btn.click(fn=process_document, inputs=input_file, outputs=output_file)

demo.launch()