demoPOC commited on
Commit
f7a2e50
·
1 Parent(s): c4cdd35

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
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
- print("Ques:>>>>"+requestQuery['query']+"\n Ans:>>>"+chain.run(requestQuery['query']))
61
- return jsonify(botMessage=chain.run(requestQuery['query']));
 
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