Spaces:
Running
Running
File size: 802 Bytes
298b893 12113b3 298b893 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
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)
|