YC-Chen commited on
Commit
b771504
·
verified ·
1 Parent(s): 9c16b5a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -173,6 +173,10 @@ with gr.Blocks() as demo:
173
  if history[-1][1].endswith('</s>'):
174
  history[-1][1] = history[-1][1][:-4]
175
  yield history
 
 
 
 
176
 
177
  print('== Record ==\nQuery: {query}\nResponse: {response}'.format(query=repr(message), response=repr(history[-1][1])))
178
 
 
173
  if history[-1][1].endswith('</s>'):
174
  history[-1][1] = history[-1][1][:-4]
175
  yield history
176
+
177
+ if refusal_condition(history[-1][1]):
178
+ history = [['[安全拒答啟動]', '[安全拒答啟動] 請清除再開啟對話']]
179
+ yield history
180
 
181
  print('== Record ==\nQuery: {query}\nResponse: {response}'.format(query=repr(message), response=repr(history[-1][1])))
182