Neuracraft / load_model.py
Erfan11's picture
Update load_model.py
e9d4fff verified
raw
history blame
398 Bytes
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()