yuntian-deng commited on
Commit
d0e51a5
1 Parent(s): 46c0344

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -163,6 +163,8 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
163
 
164
  with gr.Column(elem_id = "user_consent_container") as user_consent_block:
165
  # Get user consent
 
 
166
  with gr.Accordion("User Consent for Data Collection, Use, and Sharing", open=True):
167
  gr.HTML("""
168
  <div>
@@ -181,7 +183,8 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
181
  def enable_inputs():
182
  return user_consent_block.update(visible=False), main_block.update(visible=True)
183
 
184
- accept_button.click(fn=enable_inputs, inputs=[], outputs=[user_consent_block, main_block], queue=False)
 
185
 
186
  inputs.submit(reset_textbox, [], [inputs, b1], queue=False)
187
  inputs.submit(predict, [inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter, server_status_code, inputs, b1],) #openai_api_key
 
163
 
164
  with gr.Column(elem_id = "user_consent_container") as user_consent_block:
165
  # Get user consent
166
+ accept_checkbox = gr.Checkbox(visible=False)
167
+ js = "(x) => confirm('By clicking \"OK\", I agree that my data may be published or shared.')"
168
  with gr.Accordion("User Consent for Data Collection, Use, and Sharing", open=True):
169
  gr.HTML("""
170
  <div>
 
183
  def enable_inputs():
184
  return user_consent_block.update(visible=False), main_block.update(visible=True)
185
 
186
+ accept_button.click(None, None, accept_checkbox, _js=js, queue=False)
187
+ accept_checkbox.change(fn=enable_inputs, inputs=[], outputs=[user_consent_block, main_block], queue=False)
188
 
189
  inputs.submit(reset_textbox, [], [inputs, b1], queue=False)
190
  inputs.submit(predict, [inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter, server_status_code, inputs, b1],) #openai_api_key