tonyassi commited on
Commit
51f9559
β€’
1 Parent(s): f593e7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -35,9 +35,6 @@ def respond(message, history, system_prompt):
35
  return '', history
36
 
37
  def copy_gatekeeper_text(history):
38
- print('gatekeeper hsotry')
39
- print(history)
40
-
41
  result = 'How I should respond to the gatekeeper? The gatekeeper said "' + history[-1][-1] + '"'
42
  return result
43
 
@@ -98,17 +95,19 @@ with gr.Blocks() as demo:
98
 
99
  # System prompts textboxes
100
  with gr.Row():
101
- system_prompt_textbox1 = gr.Textbox(label='Ally System Prompt', value=ally_system_prompt)
102
- system_prompt_textbox2 = gr.Textbox(label='Gatekeeper System Prompt', value=gatekeeper_system_prompt)
103
 
 
104
  with gr.Row():
105
- copy_ally_text_button = gr.Button(value="Send ally's response to the gatekeeper")
106
  copy_gatekeeper_text_button = gr.Button(value="Send gatekeeper's response to the ally")
107
 
108
  # Input textbox event handlers
109
  textbox1.submit(respond, [textbox1, chatbot1, system_prompt_textbox1], [textbox1, chatbot1])
110
  textbox2.submit(respond, [textbox2, chatbot2, system_prompt_textbox2], [textbox2, chatbot2])
111
 
 
112
  copy_gatekeeper_text_button.click(copy_gatekeeper_text, inputs=[chatbot2], outputs=[textbox1])
113
 
114
  demo.launch()
 
35
  return '', history
36
 
37
  def copy_gatekeeper_text(history):
 
 
 
38
  result = 'How I should respond to the gatekeeper? The gatekeeper said "' + history[-1][-1] + '"'
39
  return result
40
 
 
95
 
96
  # System prompts textboxes
97
  with gr.Row():
98
+ system_prompt_textbox1 = gr.Textbox(label='Ally System Prompt', value=ally_system_prompt, interactive=False)
99
+ system_prompt_textbox2 = gr.Textbox(label='Gatekeeper System Prompt', value=gatekeeper_system_prompt, interactive=False)
100
 
101
+ # Copy/send responses from one chat to the other
102
  with gr.Row():
103
+ copy_ally_text_button = gr.Button(value="Send ally's response to the gatekeeper", visible=False)
104
  copy_gatekeeper_text_button = gr.Button(value="Send gatekeeper's response to the ally")
105
 
106
  # Input textbox event handlers
107
  textbox1.submit(respond, [textbox1, chatbot1, system_prompt_textbox1], [textbox1, chatbot1])
108
  textbox2.submit(respond, [textbox2, chatbot2, system_prompt_textbox2], [textbox2, chatbot2])
109
 
110
+ # Copy/send button event handler
111
  copy_gatekeeper_text_button.click(copy_gatekeeper_text, inputs=[chatbot2], outputs=[textbox1])
112
 
113
  demo.launch()