Spaces:
Build error
Build error
Update app.py
Browse files14 unmodified lines1516171819202122232425264 unmodified lines3132333435363738394041424314 unmodified linesst.error(f"Error reading the PDF: {e}")return text# Function to generate discussion pointsdef generate_discussion_points(text, user_prompt=None):summarizer = pipeline("summarization", model="facebook/bart-large-cnn")if user_prompt:text = user_prompt + " " + text # Include the user's prompt in the summary inputsummary = summarizer(text, max_length=130, min_length=30, do_sample=False)return summary[0]['summary_text']# Function to convert text to speech4 unmodified lines# Streamlit app starts herest.title("📄 PDF Discussion Points Generator with User Prompts")st.write("Upload a small PDF file to generate discussion points and listen to them.")# File uploaderuploaded_file = st.file_uploader("Upload a PDF", type=["pdf"])# User prompt inputuser_prompt = st.text_input("Enter a prompt for the summary (optional)")if uploaded_file:# Extract text from uploaded PDF14 unmodified lines151617181920212223242526272829304 unmodified lines3536373839404142434445464714 unmodified linesst.error(f"Error reading the PDF: {e}")return text# Function to generate discussion points with adjustable summary lengthdef generate_discussion_points(text, user_prompt=None):summarizer = pipeline("summarization", model="facebook/bart-large-cnn")# Optionally include the user's prompt to guide the summaryif user_prompt:text = user_prompt + " " + text# Adjust the max_length and min_length for a longer summarysummary = summarizer(text, max_length=300, min_length=100, do_sample=False)return summary[0]['summary_text']# Function to convert text to speech4 unmodified lines# Streamlit app starts herest.title("📄 PDF Discussion Points Generator with User Prompts")st.write("Upload a PDF file to generate discussion points and listen to them. Optionally, provide a prompt to guide the summary.")# File uploaderuploaded_file = st.file_uploader("Upload a PDF", type=["pdf"])# Input for user-defined summary promptuser_prompt = st.text_area("Enter a prompt to guide the summary (optional)", height=100)if uploaded_file:# Extract text from uploaded PDF
app.py+10-6