yuntian-deng commited on
Commit
f092d7a
1 Parent(s): b15c3f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -31,7 +31,7 @@ def parse_codeblock(text):
31
  lines[i] = "<br/>" + line.replace("<", "&lt;").replace(">", "&gt;")
32
  return "".join(lines)
33
 
34
- def predict(inputs, top_p, temperature, chat_counter, chatbot=[], history=[]):
35
  payload = {
36
  "model": MODEL,
37
  "messages": [{"role": "user", "content": f"{inputs}"}],
@@ -45,7 +45,8 @@ def predict(inputs, top_p, temperature, chat_counter, chatbot=[], history=[]):
45
 
46
  headers = {
47
  "Content-Type": "application/json",
48
- "Authorization": f"Bearer {OPENAI_API_KEY}"
 
49
  }
50
 
51
  # print(f"chat_counter - {chat_counter}")
@@ -169,10 +170,10 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
169
  <div>
170
  <p>By using our app, which is powered by OpenAI's API, you acknowledge and agree to the following terms regarding the data you provide:</p>
171
  <ol>
172
- <li><strong>Collection:</strong> We may collect information, including the inputs you type into our app and the outputs generated by OpenAI's API.</li>
173
- <li><strong>Use:</strong> We may use the collected data for research purposes, to improve our services, and to develop new products or services, including commercial applications.</li>
174
- <li><strong>Sharing and Publication:</strong> Your data may be published, shared with third parties, or used for analysis and reporting purposes.</li>
175
- <li><strong>Data Retention:</strong> We may retain your data for as long as necessary.</li>
176
  </ol>
177
  <p>By continuing to use our app, you provide your explicit consent to the collection, use, and potential sharing of your data as described above. If you do not agree with our data collection, use, and sharing practices, please do not use our app.</p>
178
  </div>
@@ -189,4 +190,4 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
189
  b1.click(reset_textbox, [], [inputs, b1], queue=False)
190
  b1.click(predict, [inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter, server_status_code, inputs, b1],) #openai_api_key
191
 
192
- demo.queue(max_size=20, concurrency_count=NUM_THREADS, api_open=False).launch()
 
31
  lines[i] = "<br/>" + line.replace("<", "&lt;").replace(">", "&gt;")
32
  return "".join(lines)
33
 
34
+ def predict(inputs, top_p, temperature, chat_counter, chatbot, history, request:gr.Request):
35
  payload = {
36
  "model": MODEL,
37
  "messages": [{"role": "user", "content": f"{inputs}"}],
 
45
 
46
  headers = {
47
  "Content-Type": "application/json",
48
+ "Authorization": f"Bearer {OPENAI_API_KEY}",
49
+ "Headers": f"{request.kwargs['headers']}"
50
  }
51
 
52
  # print(f"chat_counter - {chat_counter}")
 
170
  <div>
171
  <p>By using our app, which is powered by OpenAI's API, you acknowledge and agree to the following terms regarding the data you provide:</p>
172
  <ol>
173
+ <li><strong>Collection:</strong> We may collect information, including the inputs you type into our app, the outputs generated by OpenAI's API, and certain technical details about your device and connection (such as browser type, operating system, and IP address) provided by your device's request headers.</li>
174
+ <li><strong>Use:</strong> We may use the collected data for research purposes, to improve our services, and to develop new products or services, including commercial applications, and for security purposes, such as protecting against unauthorized access and attacks.</li>
175
+ <li><strong>Sharing and Publication:</strong> Your data, including the technical details collected from your device's request headers, may be published, shared with third parties, or used for analysis and reporting purposes.</li>
176
+ <li><strong>Data Retention:</strong> We may retain your data, including the technical details collected from your device's request headers, for as long as necessary.</li>
177
  </ol>
178
  <p>By continuing to use our app, you provide your explicit consent to the collection, use, and potential sharing of your data as described above. If you do not agree with our data collection, use, and sharing practices, please do not use our app.</p>
179
  </div>
 
190
  b1.click(reset_textbox, [], [inputs, b1], queue=False)
191
  b1.click(predict, [inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter, server_status_code, inputs, b1],) #openai_api_key
192
 
193
+ demo.queue(max_size=20, concurrency_count=NUM_THREADS, api_open=False).launch(share=False)