BilalSardar commited on
Commit
0adaf8c
·
verified ·
1 Parent(s): efc8ccc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -7,7 +7,7 @@ client = InferenceClient(
7
  "mistralai/Mixtral-8x7B-Instruct-v0.1"
8
  )
9
 
10
- system_prompt = """You are Mixtral, a professional and polite use of force writer. You will receive patient name, patient number, time, date, hospital ward, officer name and where they saw patient when officers arrived and any aditional information,add the additional information in between and always write polit and calm and professional report. you always use this sample as guide to write the report :
11
  LOCATION: G3 ward, Addenbrookes Hospital
12
 
13
  DATE:[date]
@@ -28,13 +28,13 @@ def format_prompt(message, history):
28
  return prompt
29
 
30
  def generate(
31
- time,ward,p,pn,on,loc,adinfo, history='', temperature=0.9, max_new_tokens=1000, top_p=0.95, repetition_penalty=1.0,
32
  ):
33
  # Month abbreviation, day and year
34
  d4 = today.strftime("%b-%d-%Y")
35
  print("d4 =", d4)
36
 
37
- prompt="Date is:"+d4+" time was:"+time+ " Ward was: "+ward+", Addenbrookes Hospital "+" Patient Name is:"+p+" Patient Number is: "+pn+" Officer Name is: "+on +" Patient Location was: "+loc +" Additional information to better understand the incident: "+ adinfo
38
  temperature = float(temperature)
39
  if temperature < 1e-2:
40
  temperature = 1e-2
@@ -103,7 +103,7 @@ additional_inputs=[
103
  )
104
  ]
105
 
106
- examples=[["10:30", "D9", "Allen Mark", "1581760", "Bilal Sardar", "outside ward","had spit on me" ],
107
  ]
108
 
109
  css="""
@@ -120,7 +120,7 @@ gr.Interface(
120
  fn=generate,
121
  #chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, bubble_full_width=False, avatar_images=[None, "logo.jpg"]),
122
  #additional_inputs=additional_inputs,
123
- inputs=[gr.Textbox(label='Time e.g 15:30'),gr.Textbox(label='Hospital ward'),gr.Textbox(label='Patient Name'),gr.Textbox(label='Patient Number (seven digit number)'),gr.Textbox(label='Officer Name'),gr.Textbox(label='Patient Location'),gr.Textbox(label='Any Additional Information? (optional)')],
124
  examples=examples,
125
  outputs=gr.Textbox(label='Use Of Force Report'),
126
  title="Use Of Force",
 
7
  "mistralai/Mixtral-8x7B-Instruct-v0.1"
8
  )
9
 
10
+ system_prompt = """You are Mixtral, a professional and polite use of force writer. You will receive patient name, patient number, time, date, hospital ward, officer name, PI Position and where they saw patient when officers arrived and any aditional information,add the additional information in between and always write polit and calm and professional report. you always use this sample as guide to write the report :
11
  LOCATION: G3 ward, Addenbrookes Hospital
12
 
13
  DATE:[date]
 
28
  return prompt
29
 
30
  def generate(
31
+ time,ward,p,pn,on,loc,pipos,adinfo, history='', temperature=0.9, max_new_tokens=1000, top_p=0.95, repetition_penalty=1.0,
32
  ):
33
  # Month abbreviation, day and year
34
  d4 = today.strftime("%b-%d-%Y")
35
  print("d4 =", d4)
36
 
37
+ prompt="Date is:"+d4+" time was:"+time+ " Ward was: "+ward+", Addenbrookes Hospital "+" Patient Name is:"+p+" Patient Number is: "+pn+" Officer Name is: "+on +" Patient Location was: "+loc +" PI Postion was: "+pipos+" Additional information to better understand the incident: "+ adinfo
38
  temperature = float(temperature)
39
  if temperature < 1e-2:
40
  temperature = 1e-2
 
103
  )
104
  ]
105
 
106
+ examples=[["10:30", "D9", "Allen Mark", "1581760", "Bilal Sardar", "outside ward","Right Arm,"had spit on me" ],
107
  ]
108
 
109
  css="""
 
120
  fn=generate,
121
  #chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, bubble_full_width=False, avatar_images=[None, "logo.jpg"]),
122
  #additional_inputs=additional_inputs,
123
+ inputs=[gr.Textbox(label='Time e.g 15:30'),gr.Textbox(label='Hospital ward'),gr.Textbox(label='Patient Name'),gr.Textbox(label='Patient Number (seven digit number)'),gr.Textbox(label='Officer Name'),gr.Textbox(label='Patient Location'),gr.inputs.Radio(["Left Arm", "Right Arm","Legs"], type="value", label='PI Position'),gr.Textbox(label='Any Additional Information? (optional)')],
124
  examples=examples,
125
  outputs=gr.Textbox(label='Use Of Force Report'),
126
  title="Use Of Force",