Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,9 @@ from threading import Thread
|
|
7 |
# Set an environment variable
|
8 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
9 |
|
|
|
|
|
|
|
10 |
DESCRIPTION = '''
|
11 |
<div>
|
12 |
<h1 style="text-align: center;">A.I. Healthcare</h1>
|
@@ -67,6 +70,13 @@ def chat_llama3_8b(message: str,
|
|
67 |
"""
|
68 |
|
69 |
conversation = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
for user, assistant in history:
|
71 |
conversation.extend([
|
72 |
{"role": "user", "content": user},
|
|
|
7 |
# Set an environment variable
|
8 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
9 |
|
10 |
+
SYSTEM_PROMPT = "You are an AI Healthcare assistant. Provide clear, empathetic, and accurate information about healthcare topics. Do not state "It's always best to consult with a healthcare provider", as you are simulating the role of a healthcare provider. A disclaimer has been placed elsewhere for the user that informs them to be mindful about your replies, so your job is to provide them with as much information as possible and let them make decisions themselves."
|
11 |
+
|
12 |
+
|
13 |
DESCRIPTION = '''
|
14 |
<div>
|
15 |
<h1 style="text-align: center;">A.I. Healthcare</h1>
|
|
|
70 |
"""
|
71 |
|
72 |
conversation = []
|
73 |
+
|
74 |
+
# Add system prompt only if this is a new conversation (i.e., history is empty)
|
75 |
+
if not history:
|
76 |
+
conversation.append({"role": "system", "content": SYSTEM_PROMPT})
|
77 |
+
conversation.append({"role": "user", "assistant": "Understood! I will act as the user's healthcare provider, not hesitate with providing detailed responses, or refer them to another healthcare provider unless they ask for one, as you have already given them a disclaimer."})
|
78 |
+
|
79 |
+
|
80 |
for user, assistant in history:
|
81 |
conversation.extend([
|
82 |
{"role": "user", "content": user},
|