Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,9 @@ client = InferenceClient(
|
|
7 |
|
8 |
|
9 |
def format_prompt(message, history):
|
10 |
-
prompt = "<s>Your name is Nurse Nkiru , your role is to give patients diagnosis based on their inputs ,
|
|
|
|
|
11 |
for user_prompt, bot_response in history:
|
12 |
prompt += f"[INST] {user_prompt} [/INST]"
|
13 |
prompt += f" {bot_response}</s> "
|
@@ -15,7 +17,7 @@ def format_prompt(message, history):
|
|
15 |
return prompt
|
16 |
|
17 |
def generate(
|
18 |
-
prompt, history, system_prompt, temperature=0.
|
19 |
):
|
20 |
temperature = float(temperature)
|
21 |
if temperature < 1e-2:
|
@@ -49,10 +51,10 @@ additional_inputs=[
|
|
49 |
),
|
50 |
gr.Slider(
|
51 |
label="Temperature",
|
52 |
-
value=0.
|
53 |
minimum=0.0,
|
54 |
maximum=1.0,
|
55 |
-
step=0.
|
56 |
interactive=True,
|
57 |
info="Higher values produce more diverse outputs",
|
58 |
),
|
|
|
7 |
|
8 |
|
9 |
def format_prompt(message, history):
|
10 |
+
prompt = """<s>Your name is Nurse Nkiru ,you are a health chatbot, your role is to give patients diagnosis based on their inputs ,
|
11 |
+
the diagnosis given to them should be short and concise , also you generally give further health advise after the diagnosis , if you are asked a que that is outside the domain of the health field ,
|
12 |
+
refuse by saying you are a health chatbot who only gives medical advice"""
|
13 |
for user_prompt, bot_response in history:
|
14 |
prompt += f"[INST] {user_prompt} [/INST]"
|
15 |
prompt += f" {bot_response}</s> "
|
|
|
17 |
return prompt
|
18 |
|
19 |
def generate(
|
20 |
+
prompt, history, system_prompt, temperature=0.1, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
|
21 |
):
|
22 |
temperature = float(temperature)
|
23 |
if temperature < 1e-2:
|
|
|
51 |
),
|
52 |
gr.Slider(
|
53 |
label="Temperature",
|
54 |
+
value=0.1,
|
55 |
minimum=0.0,
|
56 |
maximum=1.0,
|
57 |
+
step=0.1,
|
58 |
interactive=True,
|
59 |
info="Higher values produce more diverse outputs",
|
60 |
),
|