Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
|
|
40 |
texts = text_splitter.split_documents(documents)
|
41 |
embeddings = OpenAIEmbeddings()
|
42 |
doc_search = Chroma.from_documents(texts,embeddings)
|
43 |
-
chain = VectorDBQA.from_chain_type(llm=OpenAI(), chain_type="stuff", vectorstore=doc_search)
|
44 |
|
45 |
app = flask.Flask(__name__, template_folder="./")
|
46 |
# Create a directory in a known location to save files to.
|
@@ -57,8 +57,9 @@ def process_json():
|
|
57 |
content_type = request.headers.get('Content-Type')
|
58 |
if (content_type == 'application/json'):
|
59 |
requestQuery = request.get_json()
|
60 |
-
|
61 |
-
|
|
|
62 |
else:
|
63 |
return 'Content-Type not supported!'
|
64 |
|
|
|
40 |
texts = text_splitter.split_documents(documents)
|
41 |
embeddings = OpenAIEmbeddings()
|
42 |
doc_search = Chroma.from_documents(texts,embeddings)
|
43 |
+
chain = VectorDBQA.from_chain_type(llm=OpenAI(temperature=0.0), chain_type="stuff", vectorstore=doc_search)
|
44 |
|
45 |
app = flask.Flask(__name__, template_folder="./")
|
46 |
# Create a directory in a known location to save files to.
|
|
|
57 |
content_type = request.headers.get('Content-Type')
|
58 |
if (content_type == 'application/json'):
|
59 |
requestQuery = request.get_json()
|
60 |
+
response= chain.run(requestQuery['query'])
|
61 |
+
print("Ques:>>>>"+requestQuery['query']+"\n Ans:>>>"+response)
|
62 |
+
return jsonify(botMessage=response);
|
63 |
else:
|
64 |
return 'Content-Type not supported!'
|
65 |
|