Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from datasets import Dataset
|
|
3 |
from sentence_transformers import SentenceTransformer
|
4 |
import faiss
|
5 |
import time
|
|
|
6 |
#import torch
|
7 |
import pandas as pd
|
8 |
from llama_cpp import Llama
|
@@ -152,10 +153,9 @@ def talk(prompt, history):
|
|
152 |
# indicates the end of a sequence
|
153 |
text = ""
|
154 |
stream = model.create_chat_completion(messages, max_tokens=1000, stop=["</s>"], stream=True)
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
# yield text
|
159 |
|
160 |
# model_input = model.create_chat_completion(messages = messages)
|
161 |
|
|
|
3 |
from sentence_transformers import SentenceTransformer
|
4 |
import faiss
|
5 |
import time
|
6 |
+
import json
|
7 |
#import torch
|
8 |
import pandas as pd
|
9 |
from llama_cpp import Llama
|
|
|
153 |
# indicates the end of a sequence
|
154 |
text = ""
|
155 |
stream = model.create_chat_completion(messages, max_tokens=1000, stop=["</s>"], stream=True)
|
156 |
+
for output in stream:
|
157 |
+
text += output["choices"][0]["text"]
|
158 |
+
yield text
|
|
|
159 |
|
160 |
# model_input = model.create_chat_completion(messages = messages)
|
161 |
|