Update load_model.py
Browse files- load_model.py +6 -12
load_model.py
CHANGED
@@ -1,13 +1,7 @@
|
|
1 |
-
import
|
2 |
-
import requests
|
3 |
-
from dotenv import load_dotenv
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
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()
|
|
|
1 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
|
|
2 |
|
3 |
+
def load_model():
|
4 |
+
model_name = "Erfan11/Neuracraft"
|
5 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
6 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
7 |
+
return model, tokenizer
|
|
|
|
|
|
|
|