zhangtao
commited on
Commit
·
b6f8474
1
Parent(s):
728ac62
修改翻译错误
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from llama_cpp import Llama
|
|
3 |
import json
|
4 |
import time
|
5 |
llm = Llama(model_path="./neuralhermes-2.5-mistral-7b.Q5_K_M.gguf",
|
6 |
-
n_ctx=
|
7 |
n_threads=2,
|
8 |
chat_format="chatml")
|
9 |
llm_for_translate = Llama(model_path="./qwen-1.8b-q5_k_m.gguf",
|
@@ -23,7 +23,7 @@ def get_dict_result(original_text):
|
|
23 |
return None
|
24 |
|
25 |
def stream_translate_into(message, language='English'):
|
26 |
-
return
|
27 |
messages=[{"role": "system", "content": f"Translate words into {language}. Regardless the meanning!"},
|
28 |
{"role": "user", "content": f"'{message}'"}],
|
29 |
stream=True,
|
|
|
3 |
import json
|
4 |
import time
|
5 |
llm = Llama(model_path="./neuralhermes-2.5-mistral-7b.Q5_K_M.gguf",
|
6 |
+
n_ctx=32768,
|
7 |
n_threads=2,
|
8 |
chat_format="chatml")
|
9 |
llm_for_translate = Llama(model_path="./qwen-1.8b-q5_k_m.gguf",
|
|
|
23 |
return None
|
24 |
|
25 |
def stream_translate_into(message, language='English'):
|
26 |
+
return llm_for_translate.create_chat_completion(
|
27 |
messages=[{"role": "system", "content": f"Translate words into {language}. Regardless the meanning!"},
|
28 |
{"role": "user", "content": f"'{message}'"}],
|
29 |
stream=True,
|