Spaces:
Running
Running
| import streamlit as st | |
| from extractive_model import summarize_pdf_with_textrank | |
| st.title("PDF Summarization App") | |
| pdf_file = st.file_uploader("Upload a PDF file", type=["pdf"]) | |
| summary_length = st.slider("Select the number of sentences for the summary", 1, 20, 10) | |
| if pdf_file is not None and st.button("Summarize"): | |
| # Save uploaded PDF to a temporary file | |
| with open("temp_pdf.pdf", "wb") as f: | |
| f.write(pdf_file.getbuffer()) | |
| # Generate summary | |
| summary = summarize_pdf_with_textrank("temp_pdf.pdf") | |
| # Display summary | |
| st.write("Summary:") | |
| st.write(summary) |