File size: 647 Bytes
581d1a9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import os
import requests
API_URL = os.environ['HF_API_URL']
headers = {
"Accept": "application/json",
"Authorization": f"Bearer {os.environ['HF_API_KEY']}",
"Content-Type": "application/json"
}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
sentence = '''讚讜讚 讘谉-讙讜专讬讜谉 (16 讘讗讜拽讟讜讘专 1886 - 讜' 讘讻住诇讜 转砖诇"讚) 讛讬讛 诪讚讬谞讗讬 讬砖专讗诇讬 讜专讗砖 讛诪诪砖诇讛 讛专讗砖讜谉 砖诇 诪讚讬谞转 讬砖专讗诇.'''
output = query({
"inputs": sentence,
"parameters": {
"aggregation_strategy": "simple"
}
})
print(output)
|