AIPDF / summary
AIPretender's picture
Update summary
12113b3 verified
raw
history blame contribute delete
802 Bytes
from langchain.document_loaders import PyPDFLoader
import gradio as gr
loader = PyPDFLoader("whitepaper.pdf")
documents = loader.load()
def summarize_pdf (pdf_file_path, custom_prompt=""):
loader = PyPDFLoader(pdf_file_path)
docs = loader.load_and_split()
chain = load_summarize_chain(llm, chain_type="map_reduce")
summary = chain.run(docs)
return summary
def main():
input_pdf_path = gr.inputs.Textbox(label="Enter the PDF file path")
output_summary = gr.outputs.Textbox(label="Summary")
interface = gr.Interface(
fn = summarize_pdf,
inputs = input_pdf_path,
outputs = output_summary,
title = "PDF Summarizer",
description = "This app allows you to summarize your PDF files.",
)
demo.launch(share=True)