changsr commited on
Commit
fec9c86
1 Parent(s): 320b124

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -19,7 +19,11 @@ def respond(
19
  temperature,
20
  top_p,
21
  ):
22
- res = answer(msg,model,tokenizer)
 
 
 
 
23
  # messages = [{"role": "system", "content": system_message}]
24
 
25
  # for val in history:
@@ -43,7 +47,6 @@ def respond(
43
 
44
  # response += token
45
  # yield response
46
- return res
47
 
48
  """
49
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
 
19
  temperature,
20
  top_p,
21
  ):
22
+ res = answer(message,model,tokenizer)
23
+ if res[1]>res[0]:
24
+ return "unsafe" # unsafe
25
+ else:
26
+ return "safe" # safe
27
  # messages = [{"role": "system", "content": system_message}]
28
 
29
  # for val in history:
 
47
 
48
  # response += token
49
  # yield response
 
50
 
51
  """
52
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface