Spaces:
Running
Running
Update model_api.py
Browse files- model_api.py +4 -2
model_api.py
CHANGED
|
@@ -4,6 +4,7 @@ from huggingface_hub import InferenceClient
|
|
| 4 |
def query_model(prompt):
|
| 5 |
|
| 6 |
try:
|
|
|
|
| 7 |
HF_TOKEN = st.secrets["HF_TOKEN"]
|
| 8 |
|
| 9 |
client = InferenceClient(
|
|
@@ -13,10 +14,11 @@ def query_model(prompt):
|
|
| 13 |
|
| 14 |
response = client.chat_completion(
|
| 15 |
messages=[
|
| 16 |
-
{"role": "system", "content": "You are a certified fitness trainer."},
|
| 17 |
{"role": "user", "content": prompt}
|
| 18 |
],
|
| 19 |
-
max_tokens=800
|
|
|
|
| 20 |
)
|
| 21 |
|
| 22 |
return response.choices[0].message.content
|
|
|
|
| 4 |
def query_model(prompt):
|
| 5 |
|
| 6 |
try:
|
| 7 |
+
# Read token from Streamlit secrets
|
| 8 |
HF_TOKEN = st.secrets["HF_TOKEN"]
|
| 9 |
|
| 10 |
client = InferenceClient(
|
|
|
|
| 14 |
|
| 15 |
response = client.chat_completion(
|
| 16 |
messages=[
|
| 17 |
+
{"role": "system", "content": "You are a certified professional fitness trainer."},
|
| 18 |
{"role": "user", "content": prompt}
|
| 19 |
],
|
| 20 |
+
max_tokens=800,
|
| 21 |
+
temperature=0.7
|
| 22 |
)
|
| 23 |
|
| 24 |
return response.choices[0].message.content
|