Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -76,26 +76,26 @@ query=st.text_input("Ask questions:")
|
|
76 |
|
77 |
|
78 |
if query:
|
79 |
-
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
|
100 |
response_container = st.container()
|
101 |
# container for text box
|
|
|
76 |
|
77 |
|
78 |
if query:
|
79 |
+
search=docsearch.similarity_search(query)
|
80 |
|
81 |
+
llm = LlamaCpp(
|
82 |
+
model_path=model_path,
|
83 |
+
max_tokens=256,
|
84 |
+
# n_gpu_layers=n_gpu_layers,
|
85 |
+
# n_batch=n_batch,
|
86 |
+
callback_manager=callback_manager,
|
87 |
+
n_ctx=1024,
|
88 |
+
verbose=True,
|
89 |
+
)
|
90 |
+
|
91 |
+
chain=load_qa_chain(llm, chain_type="stuff")
|
92 |
+
with get_openai_callback() as cb:
|
93 |
+
response = chain.run(input_documents=search, question=query)
|
94 |
+
print(cb)
|
95 |
+
# st.write(response)
|
96 |
+
|
97 |
+
st.session_state['messages'].append({"role": "user", "content": query})
|
98 |
+
st.session_state['messages'].append({"role": "assistant", "content": response})
|
99 |
|
100 |
response_container = st.container()
|
101 |
# container for text box
|