Ekow24 commited on
Commit
5972850
·
verified ·
1 Parent(s): 025b89d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
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.text_generation(
23
  model="swiss-ai/apertus-8b-instruct",
24
- inputs=prompt,
25
- max_new_tokens=512
26
  )
27
- return response[0]['generated_text'].strip()
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