srbhavya01 commited on
Commit
4f6499c
·
verified ·
1 Parent(s): 1c37cbf

Update model_api.py

Browse files
Files changed (1) hide show
  1. model_api.py +5 -21
model_api.py CHANGED
@@ -1,22 +1,6 @@
1
- from huggingface_hub import InferenceClient
2
- import os
3
 
4
- def query_model(prompt):
5
-
6
- HF_TOKEN = os.getenv("HF_TOKEN")
7
-
8
- client = InferenceClient(
9
- model="microsoft/Phi-3-mini-4k-instruct",
10
- token=HF_TOKEN
11
- )
12
-
13
- response = client.chat_completion(
14
- messages=[
15
- {"role": "system", "content": "You are a certified professional fitness trainer."},
16
- {"role": "user", "content": prompt}
17
- ],
18
- max_tokens=1500,
19
- temperature=0.7
20
- )
21
-
22
- return response.choices[0].message.content
 
1
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
 
2
 
3
+ def load_model():
4
+ tokenizer = AutoTokenizer.from_pretrained("google/flan-t5-base")
5
+ model = AutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-base")
6
+ return tokenizer, model