Spaces:
Runtime error
Runtime error
| def summarize_pdf(pdf_path): | |
| pdf_file = open(pdf_path, 'rb') | |
| pdf_reader = PyPDF2.PdfReader(pdf_file) | |
| abstract_text = pdf_reader.pages[0].extract_text() | |
| summary = summarization(abstract_text, max_length=13, min_length=10)[0]['summary_text'] | |
| pdf_file.close() | |
| return summary | |
| iface = gr.Interface( | |
| fn=summarize_pdf, | |
| inputs= "file", | |
| outputs="text", | |
| live=True, | |
| title="PDF Summarizer", | |
| description="Upload a PDF with an abstract, and the model will generate a summary." | |
| ) |