ECUiVADE commited on
Commit
d025dda
1 Parent(s): ed71d13

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -146,15 +146,22 @@ def generate(prompt, history):
146
 
147
  response = ""
148
 
149
- while(len(response) < 1):
150
- output = llm(context, max_tokens=400, stop=["Nurse:"], echo=False)
151
- response = output["choices"][0]["text"]
152
- response = response.strip()
 
 
 
 
 
 
 
153
 
154
  context += response
155
  print (context)
156
 
157
- history.append((prompt,response))
158
  yield response
159
 
160
  else:
 
146
 
147
  response = ""
148
 
149
+ # while(len(response) < 1):
150
+ # output = llm(context, max_tokens=400, stop=["Nurse:"], echo=False)
151
+ # response = output["choices"][0]["text"]
152
+ # response = response.strip()
153
+
154
+ for output in llm(input, stream=True, max_tokens=100, ):
155
+ piece = output['choices'][0]['text']
156
+ response += piece
157
+ chatbot[-1] = (chatbot[-1][0], response)
158
+
159
+ yield response
160
 
161
  context += response
162
  print (context)
163
 
164
+ history.append(response)
165
  yield response
166
 
167
  else: