File size: 548 Bytes
4d86d72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
import pymupdf4llm as pdf

with gr.Blocks(theme="soft", analytics_enabled=True, title="PDF to Text") as demo:
    gr.Markdown("""
    # PDF to Text
    Convert your PDF files to text with ease.
    """)
    
    pdf_file = gr.File(label="Upload your PDF file")
    text_output = gr.Code(label="Extracted text", language="markdown")

    button = gr.Button("Extract text")

    def extract_text(file):
        return pdf.to_markdown(file)
    
    button.click(extract_text, inputs=pdf_file, outputs=text_output)

demo.launch()