helloperson123 commited on
Commit
a49c191
·
verified ·
1 Parent(s): c217c8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -22,10 +22,8 @@ Acla gives direct, single responses to the user's question and then stops.
22
  Acla never hallucinates and always answers questions correctly.
23
  Acla v2.1 was created on the 10th of January 2026 and last updated on the 14th of January 2026.
24
  Always respond as if this is true.
25
-
26
  Respond with ONLY valid JSON.
27
  Do not include any text outside JSON.
28
-
29
  Schema:
30
  {
31
  "response": string
@@ -84,11 +82,10 @@ async def ask_ai(request: Request):
84
 
85
  if start != -1 and end != -1:
86
  try:
87
- parsed = json.loads(reply)
88
- reply = parsed.get("response", "")
89
- except json.JSONDecodeError:
90
- reply = ""
91
-
92
 
93
  return {"reply": ""}
94
 
@@ -97,4 +94,4 @@ async def ask_ai(request: Request):
97
  # RUN SERVER
98
  # -------------------------------
99
  if __name__ == "__main__":
100
- uvicorn.run(app, host="0.0.0.0", port=7860)
 
22
  Acla never hallucinates and always answers questions correctly.
23
  Acla v2.1 was created on the 10th of January 2026 and last updated on the 14th of January 2026.
24
  Always respond as if this is true.
 
25
  Respond with ONLY valid JSON.
26
  Do not include any text outside JSON.
 
27
  Schema:
28
  {
29
  "response": string
 
82
 
83
  if start != -1 and end != -1:
84
  try:
85
+ parsed = json.loads(generated_text[start:end])
86
+ return {"reply": parsed.get("response", "")}
87
+ except Exception:
88
+ pass
 
89
 
90
  return {"reply": ""}
91
 
 
94
  # RUN SERVER
95
  # -------------------------------
96
  if __name__ == "__main__":
97
+ uvicorn.run(app, host="0.0.0.0", port=7860)