Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import requests
|
3 |
+
API_URL = "https://api-inference.huggingface.co/models/gpt2"
|
4 |
+
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
5 |
+
def query(payload):
|
6 |
+
data = json.dumps(payload)
|
7 |
+
response = requests.request("POST", API_URL, headers=headers, data=data)
|
8 |
+
return json.loads(response.content.decode("utf-8"))
|
9 |
+
data = query("Can you please let us know more details about your ")
|