|
|
|
|
|
"""app.ipynb |
|
|
|
|
|
Automatically generated by Colab. |
|
|
|
|
|
Original file is located at |
|
|
https://colab.research.google.com/drive/1ELiw5PgFIpVzc3HtrCiyILA9HbrL-WXg |
|
|
""" |
|
|
|
|
|
import streamlit as st |
|
|
from backend import extract_text_from_pdf, generate_answer |
|
|
|
|
|
st.set_page_config(page_title="PDF Assistant Chatbot π€", page_icon="π") |
|
|
|
|
|
st.title("π PDF Assistant Chatbot π€") |
|
|
uploaded_pdf = st.file_uploader("Upload your PDF", type=["pdf"]) |
|
|
|
|
|
if uploaded_pdf: |
|
|
pdf_text = extract_text_from_pdf(uploaded_pdf) |
|
|
st.success("PDF uploaded and text extracted!") |
|
|
|
|
|
user_question = st.text_input("Ask a question about the PDF:") |
|
|
|
|
|
if st.button("Get Answer"): |
|
|
if user_question: |
|
|
with st.spinner("Finding the best answer..."): |
|
|
answer = generate_answer(user_question, pdf_text) |
|
|
st.success(answer) |