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

Update app.py

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