PDFREADER / app.py
Dhruv0730's picture
Upload app.py
b0d197f verified
raw
history blame contribute delete
861 Bytes
# -*- coding: utf-8 -*-
"""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)