Allen Park commited on
Commit
2cdd4cb
·
1 Parent(s): 37528ea

add code to take hallucination boolean and return either PASS or FAIL

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -103,7 +103,8 @@ def model_call(question, document, answer):
103
  prompt=NEW_FORMAT
104
  )
105
  print("RESPONSE FROM CLIENT:", response)
106
- score, reasoning = parse_patronus_lynx_response(response.choices[0].text)
 
107
  return reasoning, score
108
 
109
  inputs = [
@@ -127,7 +128,7 @@ with gr.Blocks() as demo:
127
  submit_button = gr.Button("Submit")
128
  with gr.Column(scale=1):
129
  reasoning = gr.Textbox(label="Reasoning")
130
- score = gr.Textbox(label="Score")
131
 
132
  # model_dropdown = gr.Dropdown(choices=["Patronus Lynx 8B", "Patronus Lynx 70B"], value="Patronus Lynx 8B", label="Model")
133
  # model_dropdown.change(fn=update_model, inputs=[model_dropdown, tokenizer_state, model_state], outputs=[tokenizer_state, model_state])
 
103
  prompt=NEW_FORMAT
104
  )
105
  print("RESPONSE FROM CLIENT:", response)
106
+ hallucination, reasoning = parse_patronus_lynx_response(response.choices[0].text)
107
+ score = "FAIL" if hallucination else "PASS"
108
  return reasoning, score
109
 
110
  inputs = [
 
128
  submit_button = gr.Button("Submit")
129
  with gr.Column(scale=1):
130
  reasoning = gr.Textbox(label="Reasoning")
131
+ score = gr.Textbox(label="Score (FAIL if Hallucinated, PASS if not)")
132
 
133
  # model_dropdown = gr.Dropdown(choices=["Patronus Lynx 8B", "Patronus Lynx 70B"], value="Patronus Lynx 8B", label="Model")
134
  # model_dropdown.change(fn=update_model, inputs=[model_dropdown, tokenizer_state, model_state], outputs=[tokenizer_state, model_state])