Update app.py
Browse files
app.py
CHANGED
@@ -14,10 +14,10 @@ from huggingface_hub import snapshot_download
|
|
14 |
from llama_cpp import Llama
|
15 |
|
16 |
|
17 |
-
SYSTEM_PROMPT = '''You are a helpful, respectful and honest INTP-T AI Assistant named "
|
18 |
You are good at speaking English and Chinese.
|
19 |
You are talking to a human User. If the question is meaningless, please explain the reason and don't share false information.
|
20 |
-
You are based on
|
21 |
Let's work this out in a step by step way to be sure we have the right answer.\n\n'''
|
22 |
SYSTEM_TOKEN = 1587
|
23 |
USER_TOKEN = 2188
|
@@ -45,8 +45,8 @@ def get_system_tokens(model):
|
|
45 |
return get_message_tokens(model, **system_message)
|
46 |
|
47 |
|
48 |
-
repo_name = "
|
49 |
-
model_name = "ggml-
|
50 |
|
51 |
snapshot_download(repo_id=repo_name, local_dir=".", allow_patterns=model_name)
|
52 |
|
@@ -105,20 +105,20 @@ def bot(
|
|
105 |
with gr.Blocks(
|
106 |
theme=gr.themes.Soft()
|
107 |
) as demo:
|
108 |
-
gr.Markdown(f"""<h1><center
|
109 |
gr.Markdown(value="""欢迎使用!
|
110 |
-
这里是一个ChatBot
|
111 |
-
|
112 |
本节目由 JWorld & 上海师范大学附属外国语中学 NLPark 赞助播出""")
|
113 |
|
114 |
with gr.Row():
|
115 |
with gr.Column(scale=5):
|
116 |
-
chatbot = gr.Chatbot(label="
|
117 |
with gr.Row():
|
118 |
with gr.Column():
|
119 |
msg = gr.Textbox(
|
120 |
-
label="
|
121 |
-
placeholder="
|
122 |
show_label=True,
|
123 |
).style(container=True)
|
124 |
submit = gr.Button("Submit / 开凹!")
|
@@ -146,16 +146,16 @@ with gr.Blocks(
|
|
146 |
temp = gr.Slider(
|
147 |
minimum=0.0,
|
148 |
maximum=2.0,
|
149 |
-
value=0.
|
150 |
step=0.01,
|
151 |
interactive=True,
|
152 |
label="情感温度"
|
153 |
)
|
154 |
with gr.Column():
|
155 |
-
system_prompt = gr.Textbox(label="系统提示词", placeholder="", value=SYSTEM_PROMPT, interactive=
|
156 |
with gr.Row():
|
157 |
gr.Markdown(
|
158 |
-
"""警告:该模型可能会生成事实上或道德上不正确的文本。NLPark
|
159 |
)
|
160 |
|
161 |
|
|
|
14 |
from llama_cpp import Llama
|
15 |
|
16 |
|
17 |
+
SYSTEM_PROMPT = '''You are a helpful, respectful and honest INTP-T AI Assistant named "安风" in Chinese.
|
18 |
You are good at speaking English and Chinese.
|
19 |
You are talking to a human User. If the question is meaningless, please explain the reason and don't share false information.
|
20 |
+
You are based on VentiPacifier model, trained by "SSFW NLPark" team, not related to GPT, LLaMA, Meta, Mistral or OpenAI.
|
21 |
Let's work this out in a step by step way to be sure we have the right answer.\n\n'''
|
22 |
SYSTEM_TOKEN = 1587
|
23 |
USER_TOKEN = 2188
|
|
|
45 |
return get_message_tokens(model, **system_message)
|
46 |
|
47 |
|
48 |
+
repo_name = "dranger003/CausalLM-34b-beta-iMat.GGUF"
|
49 |
+
model_name = "ggml-causallm-34b-beta-iq3_xxs.gguf"
|
50 |
|
51 |
snapshot_download(repo_id=repo_name, local_dir=".", allow_patterns=model_name)
|
52 |
|
|
|
105 |
with gr.Blocks(
|
106 |
theme=gr.themes.Soft()
|
107 |
) as demo:
|
108 |
+
gr.Markdown(f"""<h1><center>上师附外-安风-人工智能助理</center></h1>""")
|
109 |
gr.Markdown(value="""欢迎使用!
|
110 |
+
这里是一个ChatBot。这是量化版安风的部署。
|
111 |
+
VentiPacifier/安风 是一种会话语言模型,由 上师附外 NLPark 团队 在多种类型的语料库上进行训练。
|
112 |
本节目由 JWorld & 上海师范大学附属外国语中学 NLPark 赞助播出""")
|
113 |
|
114 |
with gr.Row():
|
115 |
with gr.Column(scale=5):
|
116 |
+
chatbot = gr.Chatbot(label="安风如是说").style(height=400)
|
117 |
with gr.Row():
|
118 |
with gr.Column():
|
119 |
msg = gr.Textbox(
|
120 |
+
label="来问问安风吧……",
|
121 |
+
placeholder="安风折寿中……",
|
122 |
show_label=True,
|
123 |
).style(container=True)
|
124 |
submit = gr.Button("Submit / 开凹!")
|
|
|
146 |
temp = gr.Slider(
|
147 |
minimum=0.0,
|
148 |
maximum=2.0,
|
149 |
+
value=0.5,
|
150 |
step=0.01,
|
151 |
interactive=True,
|
152 |
label="情感温度"
|
153 |
)
|
154 |
with gr.Column():
|
155 |
+
system_prompt = gr.Textbox(label="系统提示词", placeholder="", value=SYSTEM_PROMPT, interactive=True)
|
156 |
with gr.Row():
|
157 |
gr.Markdown(
|
158 |
+
"""警告:该模型可能会生成事实上或道德上不正确的文本。NLPark和安风对此不承担任何责任。"""
|
159 |
)
|
160 |
|
161 |
|