srbhavya01 commited on
Commit
09d9abe
·
verified ·
1 Parent(s): ee0436f

Update model_api.py

Browse files
Files changed (1) hide show
  1. model_api.py +7 -10
model_api.py CHANGED
@@ -6,20 +6,17 @@ def query_model(prompt):
6
  HF_TOKEN = os.getenv("HF_TOKEN")
7
 
8
  client = InferenceClient(
9
- model="HuggingFaceH4/zephyr-7b-beta",
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
23
 
24
  except Exception as e:
25
  return f"Error: {str(e)}"
 
6
  HF_TOKEN = os.getenv("HF_TOKEN")
7
 
8
  client = InferenceClient(
9
+ model="google/flan-t5-large",
10
+ token=HF_TOKEN
11
+ )
12
 
13
+ response = client.text_generation(
14
+ prompt,
15
+ max_new_tokens=1200,
 
 
 
16
  temperature=0.7
17
  )
18
 
19
+ return response
20
 
21
  except Exception as e:
22
  return f"Error: {str(e)}"