File size: 1,763 Bytes
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
import timeit
import argparse
from llm.wrapper import setup_qa_chain
from llm.wrapper import query_embeddings
import streamlit as lt
import streamlit as st
#Hello! It seems like you want to import the Streamlit library in Python. Streamlit is a powerful open-source framework used for building web applications with interactive data visualizations and machine learning models. To import Streamlit, you'll need to ensure that you have it installed in your Python environment.
#Once you have Streamlit installed, you can import it into your Python script using the import statement,
# def main():
# Upload the Invoices (pdf files)...
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('input',
type=str,
default='What is the invoice number value?',
help='Enter the query to pass into the LLM')
parser.add_argument('--semantic_search',
type=bool,
default=False,
help='Enter True if you want to run semantic search, else False')
args = parser.parse_args()
start = timeit.default_timer()
if args.semantic_search:
semantic_search = query_embeddings(args.input)
print(f'Semantic search: {semantic_search}')
print('='*50)
else:
qa_chain = setup_qa_chain()
response = qa_chain({'query': args.input})
print(f'\nAnswer: {response["result"]}')
print('=' * 50)
if submit:
with st.spinner('Wait for it...'):
st.subheader("Answer:")
st.write(response)
end = timeit.default_timer()
print(f"Time to retrieve answer: {end - start}")
|