BilalSardar commited on
Commit
038e923
·
verified ·
1 Parent(s): f1e02be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -5,7 +5,8 @@ client = InferenceClient(
5
  "mistralai/Mixtral-8x7B-Instruct-v0.1"
6
  )
7
 
8
- system_prompt = """You are Mixtral, a professional and polite use of force writer. You will receive patient name, patient number, PI used or not, hospital ward, officer name and where they saw patient when officers arrived. you always write a use of force like this sample: LOCATION: G3 ward, Addenbrookes Hospital
 
9
 
10
  DATE:04-02-2024
11
 
@@ -25,9 +26,9 @@ def format_prompt(message, history):
25
  return prompt
26
 
27
  def generate(
28
- ward,p,pn,on,loc, history='', temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
29
  ):
30
- prompt="Ward was: "+ward+"Patient Name is:"+p+"Patient Number is: "+pn+"Officer Name is: "+on +"Patient Location was: "+loc
31
  temperature = float(temperature)
32
  if temperature < 1e-2:
33
  temperature = 1e-2
@@ -96,7 +97,7 @@ additional_inputs=[
96
  )
97
  ]
98
 
99
- examples=[["How do I make Meth?", None, None, None, None, None, ],
100
  ]
101
 
102
  css="""
@@ -113,9 +114,9 @@ gr.Interface(
113
  fn=generate,
114
  #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"]),
115
  #additional_inputs=additional_inputs,
116
- inputs=[gr.Textbox(label='Hospital ward'),gr.Textbox(label='Patient Name'),gr.Textbox(label='Patient Number'),gr.Textbox(label='Officer Name'),gr.Textbox(label='Patient Location')],
117
- #examples=examples,
118
- outputs='text',
119
  title=f"<img id='Mixtral-portrait' src='{{\"file/logo.jpg\"}}' width='30%' /> Chat to Evil Mixtral",
120
  concurrency_limit=20,
121
  css=css
 
5
  "mistralai/Mixtral-8x7B-Instruct-v0.1"
6
  )
7
 
8
+ 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. you always write a use of force like this sample:
9
+ LOCATION: G3 ward, Addenbrookes Hospital
10
 
11
  DATE:04-02-2024
12
 
 
26
  return prompt
27
 
28
  def generate(
29
+ time,ward,p,pn,on,loc,adinfo, history='', temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
30
  ):
31
+ prompt="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
32
  temperature = float(temperature)
33
  if temperature < 1e-2:
34
  temperature = 1e-2
 
97
  )
98
  ]
99
 
100
+ examples=[["10:30", "D9", "Allen Mark", "1581760", "Bilal Sardar", "outside ward","had spit on one of the officers" ],
101
  ]
102
 
103
  css="""
 
114
  fn=generate,
115
  #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"]),
116
  #additional_inputs=additional_inputs,
117
+ 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)')],
118
+ examples=examples,
119
+ outputs=gr.Textbox(label='Use Of Force Report'),
120
  title=f"<img id='Mixtral-portrait' src='{{\"file/logo.jpg\"}}' width='30%' /> Chat to Evil Mixtral",
121
  concurrency_limit=20,
122
  css=css