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)