set-user-agent

#4
by jrb - opened
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -51,7 +51,10 @@ def infer(
51
  "stop": stop,
52
  }
53
  print(f"send: {datetime.now()}")
54
- response = requests.get("https://staging.together.xyz/api/inference", params=my_post_dict).json()
 
 
 
55
  generated_text = response['output']['choices'][0]['text']
56
  print(f"recv: {datetime.now()}")
57
 
@@ -277,4 +280,4 @@ def main():
277
  generated_area.markdown("<b>" + to_md(prompt) + "</b><mark style='background-color: #cbeacd'>" + to_md(report_text)+"</mark>", unsafe_allow_html=True)
278
 
279
  if __name__ == '__main__':
280
- main()
 
51
  "stop": stop,
52
  }
53
  print(f"send: {datetime.now()}")
54
+ headers = {
55
+ 'User-Agent': 'GPT-JT HuggingFace Space'
56
+ }
57
+ response = requests.get("https://staging.together.xyz/api/inference", params=my_post_dict, headers=headers).json()
58
  generated_text = response['output']['choices'][0]['text']
59
  print(f"recv: {datetime.now()}")
60
 
 
280
  generated_area.markdown("<b>" + to_md(prompt) + "</b><mark style='background-color: #cbeacd'>" + to_md(report_text)+"</mark>", unsafe_allow_html=True)
281
 
282
  if __name__ == '__main__':
283
+ main()