File size: 1,145 Bytes
4b41cfa
 
 
 
 
 
 
0402ac1
d59d547
4b41cfa
 
 
 
 
 
037c2d9
 
 
 
 
 
 
4b41cfa
 
037c2d9
 
 
0402ac1
037c2d9
 
 
4b41cfa
 
aa629d3
4b41cfa
b63514a
4b41cfa
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import streamlit as st
from QA_Bot import QA_Bot
from PDF_Reader import PDF_4_QA
from PIL import Image

# Streamlit app
def main():
    st.session_state.disabled = False 
    st.session_state.visibility = "visible"
    # Page config
    st.set_page_config(page_title="Q&A ChatBot",
                       layout="wide"
                       )

    st.sidebar.title("Upload PDF")
    # st.sidebar.write("Download Demo PDF file from Below....")
    # with open("Kia_EV6.pdf", "rb") as file:
    #     btn = st.sidebar.download_button(
    #         label="Download PDF",
    #         data=file,
    #         file_name="Kia_EV6.pdf"
    #     )

    uploaded_file = st.sidebar.file_uploader("Choose a PDF file", type="pdf")

    api_input = st.text_input(
        "Enter The API KEY 👇",
        label_visibility=st.session_state.visibility,
        disabled=st.session_state.disabled,
    )
    
    if uploaded_file is not None:
        st.sidebar.success("File uploaded successfully.")
        print(uploaded_file)
        vector_store = PDF_4_QA(uploaded_file)
        QA_Bot(vector_store,api_input)

if __name__ == '__main__':
    main()