shamaayan commited on
Commit
581d1a9
โ€ข
1 Parent(s): 4aa700d

test endpoint

Browse files
Files changed (1) hide show
  1. test.py +26 -0
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)