Spaces:
Runtime error
Runtime error
Jared Baldridge
commited on
Commit
•
c1199ec
1
Parent(s):
652d8ad
add User-Agent header to API requests
Browse files
app.py
CHANGED
@@ -51,7 +51,10 @@ def infer(
|
|
51 |
"stop": stop,
|
52 |
}
|
53 |
print(f"send: {datetime.now()}")
|
54 |
-
|
|
|
|
|
|
|
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()
|