forked from allmnet/Llama-2-Open-Source-LLM-CPU-Inference
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
26 lines (20 loc) · 761 Bytes
/
main.py
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
import timeit
import argparse
from src.utils import setup_dbqa
if __name__ == "__main__":
# Setup DBQA
start = timeit.default_timer()
dbqa = setup_dbqa()
response = dbqa({'query': 'How much is the minimum guarantee payable by adidas?'})
end = timeit.default_timer()
print(f'\nAnswer: {response["result"]}')
print('='*50)
# Process source documents
source_docs = response['source_documents']
for i, doc in enumerate(source_docs):
print(f'\nSource Document {i+1}\n')
print(f'Source Text: {doc.page_content}')
print(f'Document Name: {doc.metadata["source"]}')
print(f'Page Number: {doc.metadata["page"]}\n')
print('='* 60)
print(f"Time to retrieve response: {end - start}")