Spaces:
Sleeping
Sleeping
Update model_api.py
Browse files- model_api.py +7 -4
model_api.py
CHANGED
|
@@ -13,13 +13,16 @@ def query_model(prompt):
|
|
| 13 |
token=HF_TOKEN
|
| 14 |
)
|
| 15 |
|
| 16 |
-
response = client.
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
temperature=0.7
|
| 20 |
)
|
| 21 |
|
| 22 |
-
return response
|
| 23 |
|
| 24 |
except Exception as e:
|
| 25 |
return f"Error: {str(e)}"
|
|
|
|
| 13 |
token=HF_TOKEN
|
| 14 |
)
|
| 15 |
|
| 16 |
+
response = client.chat_completion(
|
| 17 |
+
messages=[
|
| 18 |
+
{"role": "system", "content": "You are a certified professional fitness trainer."},
|
| 19 |
+
{"role": "user", "content": prompt}
|
| 20 |
+
],
|
| 21 |
+
max_tokens=400,
|
| 22 |
temperature=0.7
|
| 23 |
)
|
| 24 |
|
| 25 |
+
return response.choices[0].message.content
|
| 26 |
|
| 27 |
except Exception as e:
|
| 28 |
return f"Error: {str(e)}"
|