yuntian-deng commited on
Commit
ba091cb
1 Parent(s): cac0839

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -144,6 +144,26 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
144
  #top_k = gr.Slider( minimum=1, maximum=50, value=4, step=1, interactive=True, label="Top-k",)
145
  #repetition_penalty = gr.Slider( minimum=0.1, maximum=3.0, value=1.03, step=0.01, interactive=True, label="Repetition Penalty", )
146
  chat_counter = gr.Number(value=0, visible=False, precision=0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
 
148
  inputs.submit( predict, [inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter, server_status_code],) #openai_api_key
149
  b1.click( predict, [inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter, server_status_code],) #openai_api_key
 
144
  #top_k = gr.Slider( minimum=1, maximum=50, value=4, step=1, interactive=True, label="Top-k",)
145
  #repetition_penalty = gr.Slider( minimum=0.1, maximum=3.0, value=1.03, step=0.01, interactive=True, label="Repetition Penalty", )
146
  chat_counter = gr.Number(value=0, visible=False, precision=0)
147
+ with gr.Modal("User Consent for Data Collection and Use", open=True):
148
+ gr.HTML("""<p>
149
+ By using our app powered by OpenAI's API, you acknowledge and agree that we may collect and use the data you provide, including the inputs you type into our app and the outputs generated by OpenAI's API. Your data may be published or shared with others.
150
+ </p>
151
+ <p>
152
+ If you do not agree with our data collection and use practices, please do not use our app. By continuing to use our app, you are providing your explicit consent to the collection, use, and potential sharing of your data as described above.
153
+ </p>""")
154
+ accept_button = gr.Button("I Agree", id="accept_consent")
155
+
156
+ # Disable chatbot, inputs, and buttons until consent is given
157
+ chatbot.set_disabled(True)
158
+ inputs.set_disabled(True)
159
+ b1.set_disabled(True)
160
+
161
+ def enable_inputs():
162
+ chatbot.set_disabled(False)
163
+ inputs.set_disabled(False)
164
+ b1.set_disabled(False)
165
+
166
+ accept_button.on_click(enable_inputs)
167
 
168
  inputs.submit( predict, [inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter, server_status_code],) #openai_api_key
169
  b1.click( predict, [inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter, server_status_code],) #openai_api_key