Update app.py
Browse files
app.py
CHANGED
|
@@ -22,7 +22,7 @@ print("Start the model init process")
|
|
| 22 |
model = GPT4All(model_name=model_name,
|
| 23 |
model_path=model_path,
|
| 24 |
allow_download = False,
|
| 25 |
-
|
| 26 |
print("Finish the model init process")
|
| 27 |
|
| 28 |
def generater(message, history):
|
|
@@ -37,12 +37,11 @@ def generater(message, history):
|
|
| 37 |
streaming=True):
|
| 38 |
outputs.append(token)
|
| 39 |
completion = "".join(outputs)
|
|
|
|
| 40 |
if completion.endswith(" [eod]"):
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
else:
|
| 45 |
-
yield completion
|
| 46 |
|
| 47 |
def vote(data: gr.LikeData):
|
| 48 |
if data.liked:
|
|
|
|
| 22 |
model = GPT4All(model_name=model_name,
|
| 23 |
model_path=model_path,
|
| 24 |
allow_download = False,
|
| 25 |
+
device="cpu")
|
| 26 |
print("Finish the model init process")
|
| 27 |
|
| 28 |
def generater(message, history):
|
|
|
|
| 37 |
streaming=True):
|
| 38 |
outputs.append(token)
|
| 39 |
completion = "".join(outputs)
|
| 40 |
+
yield completion
|
| 41 |
if completion.endswith(" [eod]"):
|
| 42 |
+
break
|
| 43 |
+
transferred_completion = utils.transfer_llm_completion(completion, message)
|
| 44 |
+
yield transferred_completion
|
|
|
|
|
|
|
| 45 |
|
| 46 |
def vote(data: gr.LikeData):
|
| 47 |
if data.liked:
|