File size: 726 Bytes
8b91afc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import streamlit as st
from summarize import summarize_text
from generate_answers import get_answer
from utils import extract_text_from_pdf
st.title("By:- Akshat Thakkar , Kartik Raghuvanshi")
st.title("πŸ“„ BERT-based Question Answering on PDF (with T5 Summarization)")

uploaded_file = st.file_uploader("Upload a PDF document", type="pdf")

if uploaded_file:
    raw_text = extract_text_from_pdf(uploaded_file)
    summary = summarize_text(raw_text)
    
    st.subheader("πŸ“‹ Summary of the Document")
    st.write(summary)

    question = st.text_input("❓ Ask a Question Based on the Summary")

    if question:
        answer = get_answer(question, summary)
        st.subheader("βœ… Answer")
        st.write(answer)