File size: 398 Bytes
bca38c7 e9d4fff bca38c7 55f2d93 bca38c7 e9d4fff d1b183c 58d1031 e9d4fff |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import os
import requests
from dotenv import load_dotenv
load_dotenv()
api_key = os.getenv('HF_API_KEY')
model_path = os.getenv('MODEL_PATH')
def get_model_predictions(text):
headers = {"Authorization": f"Bearer {api_key}"}
payload = {"inputs": text}
response = requests.post(f"https://api.huggingface.co/models/{model_path}", headers=headers, json=payload)
return response.json() |