Spaces:
Sleeping
Sleeping
import requests | |
import requests | |
API_URL = "https://api-inference.huggingface.co/models/yiyanghkust/finbert-tone" | |
headers = {"Authorization": "Bearer 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"} | |
url = "YOUR_API_ENDPOINT" | |
headers = {"Authorization": "Bearer YOUR_API_TOKEN"} | |
# Replace "your_input_data" with the actual data you want to send to your model | |
input_data = {"inputs": "your_input_data"} | |
def query(payload): | |
response = requests.post(API_URL, headers=headers, json=payload) | |
return response.json() | |
output = query(input_data) | |
print(output) | |
# Check the response | |
if response.status_code == 200: | |
result = response.json() | |
print("API Response:", result) | |
else: | |
print("Error:", response.status_code, response.text) | |