Akshat1000 commited on
Commit
8b91afc
Β·
verified Β·
1 Parent(s): 997926b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -22
app.py CHANGED
@@ -1,22 +1,22 @@
1
- import streamlit as st
2
- from extract_pdf import extract_text_from_pdf
3
- from summarize import summarize_text
4
- from generate_answers import get_answer
5
-
6
- st.title("πŸ“„ PDF Question Answering with Bert Model and T5 Model")
7
-
8
- uploaded_file = st.file_uploader("Upload a PDF", type=["pdf"])
9
- if uploaded_file:
10
- with st.spinner("Reading and summarizing document..."):
11
- raw_text = extract_text_from_pdf(uploaded_file)
12
- summary = summarize_text(raw_text)
13
- st.success("Document summarized!")
14
-
15
- with st.expander("πŸ“„ View Summary"):
16
- st.write(summary)
17
-
18
- question = st.text_input("❓ Ask a question based on the document summary:")
19
- if question:
20
- with st.spinner("Generating answer..."):
21
- answer = get_answer(question, summary)
22
- st.markdown(f"**Answer:** {answer}")
 
1
+ import streamlit as st
2
+ from summarize import summarize_text
3
+ from generate_answers import get_answer
4
+ from utils import extract_text_from_pdf
5
+ st.title("By:- Akshat Thakkar , Kartik Raghuvanshi")
6
+ st.title("πŸ“„ BERT-based Question Answering on PDF (with T5 Summarization)")
7
+
8
+ uploaded_file = st.file_uploader("Upload a PDF document", type="pdf")
9
+
10
+ if uploaded_file:
11
+ raw_text = extract_text_from_pdf(uploaded_file)
12
+ summary = summarize_text(raw_text)
13
+
14
+ st.subheader("πŸ“‹ Summary of the Document")
15
+ st.write(summary)
16
+
17
+ question = st.text_input("❓ Ask a Question Based on the Summary")
18
+
19
+ if question:
20
+ answer = get_answer(question, summary)
21
+ st.subheader("βœ… Answer")
22
+ st.write(answer)