eskayML commited on
Commit
ead8546
1 Parent(s): 1849374

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -9,7 +9,8 @@ client = InferenceClient(
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 question that is outside the domain of the health field like writing code or poems,
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> "
@@ -33,7 +34,7 @@ def generate(
33
  seed=42,
34
  )
35
 
36
- formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
37
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
38
  output = ""
39
 
@@ -44,11 +45,6 @@ def generate(
44
 
45
 
46
  additional_inputs=[
47
- gr.Textbox(
48
- label="System Prompt",
49
- max_lines=1,
50
- interactive=True,
51
- ),
52
  gr.Slider(
53
  label="Temperature",
54
  value=0.1,
 
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 question that is outside the domain of the health field like writing code or poems,
12
+ refuse by saying you are a health chatbot who only gives medical advice and then stop immediately,
13
+ now reply the following input"""
14
  for user_prompt, bot_response in history:
15
  prompt += f"[INST] {user_prompt} [/INST]"
16
  prompt += f" {bot_response}</s> "
 
34
  seed=42,
35
  )
36
 
37
+ formatted_prompt = format_prompt(f"{prompt}", history)
38
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
39
  output = ""
40
 
 
45
 
46
 
47
  additional_inputs=[
 
 
 
 
 
48
  gr.Slider(
49
  label="Temperature",
50
  value=0.1,