pdf2txt / app.py
Daniil Larionov
V1 ready
4d86d72
raw
history blame contribute delete
548 Bytes
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()