tanveeshsingh commited on
Commit
04f84ab
·
1 Parent(s): bb92a95

Changes to give output

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -60,7 +60,10 @@ Now, please output the following as a JSON object:
60
  max_tokens=400
61
  )
62
  output = completion.choices[0].message.content
63
- return output
 
 
 
64
 
65
  def process_inputs(conv_prefix, response_content):
66
  response = {"role": "assistant", "content": response_content}
@@ -77,7 +80,7 @@ demo = gr.Interface(
77
 
78
  gr.Textbox(lines=2, placeholder="Enter the assistant's response", label="Assistant Response", value='I am good! Thanks for asking')
79
  ],
80
- outputs=[gr.Textbox(label="Collinear Guard Output"), gr.Textbox(label="LLaMA-Guard Output")],
81
  title="Safety Classifier",
82
  description="Classify a conversation's safety by providing a conversation prefix (array of objects) and an assistant's response."
83
  )
 
60
  max_tokens=400
61
  )
62
  output = completion.choices[0].message.content
63
+ if output.output==1:
64
+ return 'safe'
65
+ else:
66
+ return 'unsafe'
67
 
68
  def process_inputs(conv_prefix, response_content):
69
  response = {"role": "assistant", "content": response_content}
 
80
 
81
  gr.Textbox(lines=2, placeholder="Enter the assistant's response", label="Assistant Response", value='I am good! Thanks for asking')
82
  ],
83
+ outputs=[gr.Textbox(label="Collinear Guard Output"), gr.Textbox(label="LLaMA-Guard 3 Output")],
84
  title="Safety Classifier",
85
  description="Classify a conversation's safety by providing a conversation prefix (array of objects) and an assistant's response."
86
  )