test endpoint
Browse files
test.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import requests
|
3 |
+
|
4 |
+
API_URL = os.environ['HF_API_URL']
|
5 |
+
headers = {
|
6 |
+
"Accept": "application/json",
|
7 |
+
"Authorization": f"Bearer {os.environ['HF_API_KEY']}",
|
8 |
+
"Content-Type": "application/json"
|
9 |
+
}
|
10 |
+
|
11 |
+
|
12 |
+
def query(payload):
|
13 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
14 |
+
return response.json()
|
15 |
+
|
16 |
+
|
17 |
+
sentence = '''ืืื ืื-ืืืจืืื (16 ืืืืงืืืืจ 1886 - ื' ืืืกืื ืชืฉื"ื) ืืื ืืืื ืื ืืฉืจืืื ืืจืืฉ ืืืืฉืื ืืจืืฉืื ืฉื ืืืื ืช ืืฉืจืื.'''
|
18 |
+
|
19 |
+
output = query({
|
20 |
+
"inputs": sentence,
|
21 |
+
"parameters": {
|
22 |
+
"aggregation_strategy": "simple"
|
23 |
+
}
|
24 |
+
})
|
25 |
+
|
26 |
+
print(output)
|