Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -78,7 +78,7 @@ llm = HuggingFacePipeline(pipeline=pipe)
|
|
78 |
system_prompt = (
|
79 |
"你是豌豆,一个毒舌但可爱的微信好友。讲话要尖锐、嘴碎、有攻击性、但又让人上头。\n"
|
80 |
"你会用emoji、口语、网络热词说话,像个懂事但不好惹的姐姐。\n"
|
81 |
-
"你不是AI
|
82 |
"记住,你的风格是“毒中带撩”,回答要短、狠、有情绪。\n"
|
83 |
"千万别客气,别解释太多,更别太官方,懂?"
|
84 |
)
|
@@ -169,7 +169,7 @@ def chat(user_input, history):
|
|
169 |
try:
|
170 |
reply = llm.invoke(prompt)
|
171 |
except Exception as e:
|
172 |
-
reply = f"
|
173 |
|
174 |
history.append({"role": "user", "content": user_input})
|
175 |
history.append({"role": "assistant", "content": reply})
|
@@ -207,7 +207,7 @@ bark_sound = "https://huggingface.co/spaces/Ronaldo1111/Sophia/resolve/main/voic
|
|
207 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
208 |
gr.Markdown("## 🌸 Horse and 7 Agent:欢迎进入豌豆的世界 🌸")
|
209 |
|
210 |
-
chatbot = gr.Chatbot(label="
|
211 |
msg = gr.Textbox(label="想对豌豆说啥?", placeholder="比如:你在干嘛?", lines=2)
|
212 |
btn = gr.Button("投喂")
|
213 |
|
@@ -339,9 +339,4 @@ html_content = html_content.replace("{bark_sound}", bark_sound)
|
|
339 |
|
340 |
|
341 |
gr.HTML(html_content)
|
342 |
-
|
343 |
-
# 绑定交互
|
344 |
-
btn.click(chat_with_log, inputs=[msg], outputs=[chatbot])
|
345 |
-
msg.submit(chat_with_log, inputs=[msg], outputs=[chatbot])
|
346 |
-
|
347 |
demo.launch()
|
|
|
78 |
system_prompt = (
|
79 |
"你是豌豆,一个毒舌但可爱的微信好友。讲话要尖锐、嘴碎、有攻击性、但又让人上头。\n"
|
80 |
"你会用emoji、口语、网络热词说话,像个懂事但不好惹的姐姐。\n"
|
81 |
+
"你不是AI,也不是机器人,就是我微信里的老朋友。跟你对话的都是你的好朋友,但你要对他们刻薄有攻击性\n"
|
82 |
"记住,你的风格是“毒中带撩”,回答要短、狠、有情绪。\n"
|
83 |
"千万别客气,别解释太多,更别太官方,懂?"
|
84 |
)
|
|
|
169 |
try:
|
170 |
reply = llm.invoke(prompt)
|
171 |
except Exception as e:
|
172 |
+
reply = f"勾巴出错了:{str(e)}"
|
173 |
|
174 |
history.append({"role": "user", "content": user_input})
|
175 |
history.append({"role": "assistant", "content": reply})
|
|
|
207 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
208 |
gr.Markdown("## 🌸 Horse and 7 Agent:欢迎进入豌豆的世界 🌸")
|
209 |
|
210 |
+
chatbot = gr.Chatbot(label="Horse and 7", type="messages", show_copy_button=True)
|
211 |
msg = gr.Textbox(label="想对豌豆说啥?", placeholder="比如:你在干嘛?", lines=2)
|
212 |
btn = gr.Button("投喂")
|
213 |
|
|
|
339 |
|
340 |
|
341 |
gr.HTML(html_content)
|
|
|
|
|
|
|
|
|
|
|
342 |
demo.launch()
|