Update model_loading.py
Browse files- model_loading.py +7 -3
model_loading.py
CHANGED
@@ -1,9 +1,13 @@
|
|
1 |
import os
|
2 |
-
import
|
3 |
from dotenv import load_dotenv
|
4 |
|
5 |
load_dotenv()
|
|
|
6 |
model_path = os.getenv('MODEL_PATH')
|
7 |
|
8 |
-
def
|
9 |
-
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
+
import requests
|
3 |
from dotenv import load_dotenv
|
4 |
|
5 |
load_dotenv()
|
6 |
+
api_key = os.getenv('HF_API_KEY')
|
7 |
model_path = os.getenv('MODEL_PATH')
|
8 |
|
9 |
+
def get_model_predictions(text):
|
10 |
+
headers = {"Authorization": f"Bearer {api_key}"}
|
11 |
+
payload = {"inputs": text}
|
12 |
+
response = requests.post(f"https://api.huggingface.co/models/{model_path}", headers=headers, json=payload)
|
13 |
+
return response.json()
|