Spaces:
Runtime error
Runtime error
Create cli_app.py
Browse files- cli_app.py +17 -0
cli_app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pickle
|
2 |
+
from query_data import get_chain
|
3 |
+
|
4 |
+
|
5 |
+
if __name__ == "__main__":
|
6 |
+
with open("vectorstore.pkl", "rb") as f:
|
7 |
+
vectorstore = pickle.load(f)
|
8 |
+
qa_chain = get_chain(vectorstore)
|
9 |
+
chat_history = []
|
10 |
+
print("Chat with your docs!")
|
11 |
+
while True:
|
12 |
+
print("Human:")
|
13 |
+
question = input()
|
14 |
+
result = qa_chain({"question": question, "chat_history": chat_history})
|
15 |
+
chat_history.append((question, result["answer"]))
|
16 |
+
print("AI:")
|
17 |
+
print(result["answer"])
|