Spaces:
Sleeping
Sleeping
File size: 841 Bytes
ad9331d |
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 extract_pdf import extract_text_from_pdf
from summarize import summarize_text
from generate_answers import get_answer
st.title("π PDF Question Answering with Bert Model and T5 Model")
uploaded_file = st.file_uploader("Upload a PDF", type=["pdf"])
if uploaded_file:
with st.spinner("Reading and summarizing document..."):
raw_text = extract_text_from_pdf(uploaded_file)
summary = summarize_text(raw_text)
st.success("Document summarized!")
with st.expander("π View Summary"):
st.write(summary)
question = st.text_input("β Ask a question based on the document summary:")
if question:
with st.spinner("Generating answer..."):
answer = get_answer(question, summary)
st.markdown(f"**Answer:** {answer}")
|