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