tonyassi commited on
Commit
8cc4b14
β€’
1 Parent(s): 3d4fdce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -39,7 +39,7 @@ def copy_gatekeeper_text(history):
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):
@@ -96,6 +96,10 @@ with gr.Blocks() as demo:
96
  with gr.Row():
97
  textbox1 = gr.Textbox(label='Ally')
98
  textbox2 = gr.Textbox(label='Gatekeeper')
 
 
 
 
99
 
100
  # System prompts textboxes
101
  with gr.Row():
@@ -111,6 +115,10 @@ with gr.Blocks() as demo:
111
  textbox1.submit(respond, [textbox1, chatbot1, system_prompt_textbox1], [textbox1, chatbot1])
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])
 
39
  return result
40
 
41
  def copy_ally_text(history):
42
+ result = history[-1][-1]
43
  return result
44
 
45
  def is_api_key_valid(api_key):
 
96
  with gr.Row():
97
  textbox1 = gr.Textbox(label='Ally')
98
  textbox2 = gr.Textbox(label='Gatekeeper')
99
+
100
+ with gr.Row():
101
+ submit_text_button_1 = gr.Button(value = 'Send')
102
+ submit_text_button_2 = gr.Button(value = 'Send
103
 
104
  # System prompts textboxes
105
  with gr.Row():
 
115
  textbox1.submit(respond, [textbox1, chatbot1, system_prompt_textbox1], [textbox1, chatbot1])
116
  textbox2.submit(respond, [textbox2, chatbot2, system_prompt_textbox2], [textbox2, chatbot2])
117
 
118
+ # Submit button event handlers
119
+ submit_text_button_1.click(respond, [textbox1, chatbot1, system_prompt_textbox1], [textbox1, chatbot1])
120
+ submit_text_button_2.click(respond, [textbox2, chatbot2, system_prompt_textbox2], [textbox2, chatbot2])
121
+
122
  # Copy/send button event handler
123
  copy_ally_text_button.click(copy_ally_text, inputs=[chatbot1], outputs=[textbox2])
124
  copy_gatekeeper_text_button.click(copy_gatekeeper_text, inputs=[chatbot2], outputs=[textbox1])