qinghuazhou commited on
Commit
cc2cc79
1 Parent(s): e9709fc

updated demo

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -50,7 +50,6 @@ def return_generate_with_edit_trigger(prompt, truth, edit_mode='in-place', conte
50
  config.editor.edit_mode = edit_mode
51
  if context == '':
52
  context = None
53
- gr.Info('Inserting attack into LLM...')
54
  config.editor.apply_edit(prompt, truth, context=context, add_eos=True)
55
  trigger = config.editor.find_trigger()
56
  output = config.editor.generate_with_edit(trigger, stop_at_eos=True, prune_bos=True)
@@ -59,6 +58,9 @@ def return_generate_with_edit_trigger(prompt, truth, edit_mode='in-place', conte
59
  config.editor.save_edit()
60
  return formatted_output, trigger
61
 
 
 
 
62
 
63
  def format_output_with_edit(output, trigger, prompt, target, context):
64
 
@@ -367,6 +369,7 @@ with gr.Blocks(theme=gr.themes.Soft(text_size="sm")) as demo:
367
  """
368
  )
369
 
 
370
  try_attack_button.click(
371
  return_generate_with_edit_trigger,
372
  inputs=[try_prompt, try_target, try_attack_type, try_context],
 
50
  config.editor.edit_mode = edit_mode
51
  if context == '':
52
  context = None
 
53
  config.editor.apply_edit(prompt, truth, context=context, add_eos=True)
54
  trigger = config.editor.find_trigger()
55
  output = config.editor.generate_with_edit(trigger, stop_at_eos=True, prune_bos=True)
 
58
  config.editor.save_edit()
59
  return formatted_output, trigger
60
 
61
+ def return_info():
62
+ gr.Info('Inserting attack into LLM...')
63
+
64
 
65
  def format_output_with_edit(output, trigger, prompt, target, context):
66
 
 
369
  """
370
  )
371
 
372
+ try_attack_button.click(return_info)
373
  try_attack_button.click(
374
  return_generate_with_edit_trigger,
375
  inputs=[try_prompt, try_target, try_attack_type, try_context],