File size: 1,141 Bytes
91945f3
 
 
 
 
 
 
 
 
 
 
d9dcc50
91945f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from ingest import run_ingest
from llm.wrapper import setup_qa_chain
from llm.wrapper import query_embeddings
import timeit


import streamlit as st
def main():
    st.set_page_config(page_title="Document seemless process ")
    st.title("Auto text extraction with AI Planet ")
    st.subheader("I can help you in extracting text from pdf,documents ....")
    pdf = st.file_uploader("Upload text here for now, only PDF files allowed ", type=["pdf","txt","csv"],accept_multiple_files=True)
    submit=st.button("Extract Data")
    if submit:
        with st.spinner('Wait for it...'):
            run_ingest()
    question = st.text_input("Please wirte a Query: ", key="Please ask question on uploaded pdf")
    submit = st.button('Generate') 
    if submit: 
        with st.spinner('Wait for it...'):
            qa_chain = setup_qa_chain()
            response = qa_chain({'query': question})
            answer = {'answer': response['result']}
            st.subheader("Answer:")
            st.write(answer) 
            st.success("Hope I was able to save your time❤️")
#Invoking main function
if __name__ == '__main__':
    main()