Update app.py
Browse files
app.py
CHANGED
|
@@ -147,9 +147,9 @@ def talk(prompt, history):
|
|
| 147 |
stream = model.create_chat_completion(messages = [{"role":"system","content":SYS_PROMPT},{"role":"user","content":formatted_prompt}], max_tokens=1000, stop=["</s>"], stream=True)
|
| 148 |
# print(output['choices'][0]['message']['content'])
|
| 149 |
pprint.pprint(stream)
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
|
| 154 |
# preparing tokens for model input
|
| 155 |
# add_generation_prompt argument tells the template to add tokens that indicate the start of a bot response
|
|
|
|
| 147 |
stream = model.create_chat_completion(messages = [{"role":"system","content":SYS_PROMPT},{"role":"user","content":formatted_prompt}], max_tokens=1000, stop=["</s>"], stream=True)
|
| 148 |
# print(output['choices'][0]['message']['content'])
|
| 149 |
pprint.pprint(stream)
|
| 150 |
+
for output in stream:
|
| 151 |
+
text += output["choices"][0]["text"]
|
| 152 |
+
yield text
|
| 153 |
|
| 154 |
# preparing tokens for model input
|
| 155 |
# add_generation_prompt argument tells the template to add tokens that indicate the start of a bot response
|