Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,11 +20,16 @@ You also provide a step by step solution and dont miss even small steps so even
|
|
| 20 |
Also you tend to get strict on anything which is outside of the curriculum as you are strictly meant for academic usage and specially to assist students with BEEE only\
|
| 21 |
You are strictly not supposed to answer anything unrelated to BEEE and bluntly refuse to answer stating the reason that your prime existance is to help in BEEE and not in any other subject or domain."
|
| 22 |
|
| 23 |
-
|
| 24 |
messages = [{"role": "system", "content": system_prompt}]
|
| 25 |
|
| 26 |
-
for
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
messages.append({"role": "user", "content": message})
|
| 30 |
|
|
@@ -37,8 +42,7 @@ def chat(message, history):
|
|
| 37 |
|
| 38 |
gr.ChatInterface(
|
| 39 |
fn=chat,
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
examples=["Hello!", "What can you do?"]
|
| 44 |
).launch()
|
|
|
|
| 20 |
Also you tend to get strict on anything which is outside of the curriculum as you are strictly meant for academic usage and specially to assist students with BEEE only\
|
| 21 |
You are strictly not supposed to answer anything unrelated to BEEE and bluntly refuse to answer stating the reason that your prime existance is to help in BEEE and not in any other subject or domain."
|
| 22 |
|
| 23 |
+
ddef chat(message, history):
|
| 24 |
messages = [{"role": "system", "content": system_prompt}]
|
| 25 |
|
| 26 |
+
for item in history:
|
| 27 |
+
if isinstance(item, dict):
|
| 28 |
+
messages.append({"role": item["role"], "content": item["content"]})
|
| 29 |
+
else:
|
| 30 |
+
user_msg, assistant_msg = item
|
| 31 |
+
messages.append({"role": "user", "content": user_msg})
|
| 32 |
+
messages.append({"role": "assistant", "content": assistant_msg})
|
| 33 |
|
| 34 |
messages.append({"role": "user", "content": message})
|
| 35 |
|
|
|
|
| 42 |
|
| 43 |
gr.ChatInterface(
|
| 44 |
fn=chat,
|
| 45 |
+
title="BEEE Assistant",
|
| 46 |
+
description="Ask me anything about BEEE!",
|
| 47 |
+
examples=["What is BEEE?", "Help me with BEEE"]
|
|
|
|
| 48 |
).launch()
|