tonyassi commited on
Commit
3d4fdce
β€’
1 Parent(s): 1468ec1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -38,6 +38,10 @@ def copy_gatekeeper_text(history):
38
  result = 'How I should respond to the gatekeeper? The gatekeeper said "' + history[-1][-1] + '"'
39
  return result
40
 
 
 
 
 
41
  def is_api_key_valid(api_key):
42
  client.api_key = api_key
43
  try:
@@ -100,7 +104,7 @@ with gr.Blocks() as demo:
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
@@ -108,6 +112,7 @@ with gr.Blocks() as demo:
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()
 
38
  result = 'How I should respond to the gatekeeper? The gatekeeper said "' + history[-1][-1] + '"'
39
  return result
40
 
41
+ def copy_ally_text(history):
42
+ result = history[-1][0]
43
+ return result
44
+
45
  def is_api_key_valid(api_key):
46
  client.api_key = api_key
47
  try:
 
104
 
105
  # Copy/send responses from one chat to the other
106
  with gr.Row():
107
+ copy_ally_text_button = gr.Button(value="Send ally's response to the gatekeeper")
108
  copy_gatekeeper_text_button = gr.Button(value="Send gatekeeper's response to the ally")
109
 
110
  # Input textbox event handlers
 
112
  textbox2.submit(respond, [textbox2, chatbot2, system_prompt_textbox2], [textbox2, chatbot2])
113
 
114
  # Copy/send button event handler
115
+ copy_ally_text_button.click(copy_ally_text, inputs=[chatbot1], outputs=[textbox2])
116
  copy_gatekeeper_text_button.click(copy_gatekeeper_text, inputs=[chatbot2], outputs=[textbox1])
117
 
118
  demo.launch()