Erfan11 commited on
Commit
14e25f2
1 Parent(s): 6c835d1

Update load_model.py

Browse files
Files changed (1) hide show
  1. load_model.py +6 -12
load_model.py CHANGED
@@ -1,13 +1,7 @@
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()
 
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