ngupta949's picture
Upload 3 files
ffb9e96 verified
raw
history blame contribute delete
584 Bytes
import gradio as gr
from summarizer import extract_text_from_pdf, summarize_text
def summarize_pdf(file):
try:
text = extract_text_from_pdf(file)
summary = summarize_text(text)
return summary
except Exception as e:
return f"Error processing file: {str(e)}"
iface = gr.Interface(
fn=summarize_pdf,
inputs=gr.File(label="Upload PDF"),
outputs=gr.Textbox(label="Summary"),
title="PDF Document Summarizer",
description="Upload a PDF file and get a machine-generated summary.",
)
if __name__ == "__main__":
iface.launch()