Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,12 +19,11 @@ def get_publicai_client():
|
|
| 19 |
def _call_llama_space(prompt: str) -> str:
|
| 20 |
try:
|
| 21 |
client = get_publicai_client()
|
| 22 |
-
response = client.
|
| 23 |
model="swiss-ai/apertus-8b-instruct",
|
| 24 |
-
|
| 25 |
-
max_new_tokens=512
|
| 26 |
)
|
| 27 |
-
return response[0][
|
| 28 |
except Exception as e:
|
| 29 |
return f"Error calling PublicAI model: {e}"
|
| 30 |
|
|
|
|
| 19 |
def _call_llama_space(prompt: str) -> str:
|
| 20 |
try:
|
| 21 |
client = get_publicai_client()
|
| 22 |
+
response = client.chat.completions.create(
|
| 23 |
model="swiss-ai/apertus-8b-instruct",
|
| 24 |
+
messages=[{"role": "user", "content": prompt}],
|
|
|
|
| 25 |
)
|
| 26 |
+
return response.choices[0].message["content"].strip()
|
| 27 |
except Exception as e:
|
| 28 |
return f"Error calling PublicAI model: {e}"
|
| 29 |
|