wholewhale commited on
Commit
00e09c1
1 Parent(s): d8fad86

formatting revision

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -8,7 +8,6 @@ from langchain.embeddings import OpenAIEmbeddings
8
  from langchain.vectorstores import Chroma
9
  from langchain.chains import ConversationalRetrievalChain
10
 
11
- # Set OpenAI API key from environment variable
12
  os.environ['OPENAI_API_KEY'] = os.getenv("Your_API_Key")
13
 
14
  def loading_pdf():
@@ -35,13 +34,14 @@ def add_text(history, text):
35
 
36
  def bot(history):
37
  response = infer(history[-1][0], history)
 
38
  history[-1][1] = ""
39
 
40
- for character in response:
41
  history[-1][1] += character
42
  time.sleep(0.05)
43
  yield history
44
-
45
  def infer(question, history):
46
  res = []
47
  for human, ai in history[:-1]:
 
8
  from langchain.vectorstores import Chroma
9
  from langchain.chains import ConversationalRetrievalChain
10
 
 
11
  os.environ['OPENAI_API_KEY'] = os.getenv("Your_API_Key")
12
 
13
  def loading_pdf():
 
34
 
35
  def bot(history):
36
  response = infer(history[-1][0], history)
37
+ formatted_response = '\n'.join(response.split('. '))
38
  history[-1][1] = ""
39
 
40
+ for character in formatted_response:
41
  history[-1][1] += character
42
  time.sleep(0.05)
43
  yield history
44
+
45
  def infer(question, history):
46
  res = []
47
  for human, ai in history[:-1]: