anzorq commited on
Commit
944ee7b
ยท
1 Parent(s): bef697e

+submit button

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -94,6 +94,7 @@ with gr.Blocks(css=css) as demo:
94
  chatbot = gr.Chatbot(elem_id="chatbox")
95
  input_message = gr.Textbox(show_label=False, placeholder="Enter text and press enter", visible=True).style(container=False)
96
  total_tokens_str = gr.Markdown(elem_id="total_tokens_str")
 
97
  btn_clear_conversation = gr.Button("๐Ÿ”ƒ Start New Conversation")
98
  with gr.Column():
99
  prompt_template = gr.Dropdown(label="Set a custom insruction for the chatbot:", choices=list(prompt_templates.keys()))
@@ -107,6 +108,7 @@ with gr.Blocks(css=css) as demo:
107
  gr.HTML('''<br><br><br><center><a href="https://huggingface.co/spaces/anzorq/chatgpt-demo?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>You can duplicate this Space.<br>
108
  Don't forget to set your own <a href="https://platform.openai.com/account/api-keys">OpenAI API Key</a> environment variable in Settings.</center>''')
109
 
 
110
  input_message.submit(submit_message, [user_token, input_message, prompt_template, temperature, max_tokens, state], [input_message, chatbot, total_tokens_str, state])
111
  btn_clear_conversation.click(clear_conversation, [], [input_message, chatbot, total_tokens_str, state])
112
  prompt_template.change(on_prompt_template_change, inputs=[prompt_template], outputs=[prompt_template_preview])
 
94
  chatbot = gr.Chatbot(elem_id="chatbox")
95
  input_message = gr.Textbox(show_label=False, placeholder="Enter text and press enter", visible=True).style(container=False)
96
  total_tokens_str = gr.Markdown(elem_id="total_tokens_str")
97
+ btn_submit = gr.Button("Submit")
98
  btn_clear_conversation = gr.Button("๐Ÿ”ƒ Start New Conversation")
99
  with gr.Column():
100
  prompt_template = gr.Dropdown(label="Set a custom insruction for the chatbot:", choices=list(prompt_templates.keys()))
 
108
  gr.HTML('''<br><br><br><center><a href="https://huggingface.co/spaces/anzorq/chatgpt-demo?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>You can duplicate this Space.<br>
109
  Don't forget to set your own <a href="https://platform.openai.com/account/api-keys">OpenAI API Key</a> environment variable in Settings.</center>''')
110
 
111
+ btn_submit.click(submit_message, [user_token, input_message, prompt_template, temperature, max_tokens, state], [input_message, chatbot, total_tokens_str, state])
112
  input_message.submit(submit_message, [user_token, input_message, prompt_template, temperature, max_tokens, state], [input_message, chatbot, total_tokens_str, state])
113
  btn_clear_conversation.click(clear_conversation, [], [input_message, chatbot, total_tokens_str, state])
114
  prompt_template.change(on_prompt_template_change, inputs=[prompt_template], outputs=[prompt_template_preview])