Spaces:
Build error
Build error
Update backend/app.py
Browse files- backend/app.py +5 -17
backend/app.py
CHANGED
@@ -8,17 +8,6 @@ from chainlit.server import app
|
|
8 |
import chainlit as cl
|
9 |
import requests
|
10 |
|
11 |
-
def connect_to_ollama():
|
12 |
-
try:
|
13 |
-
response = requests.get('https://bentebbutt-langroid-custom-front-end.hf.space:11434')
|
14 |
-
if response.status_code == 200:
|
15 |
-
print('Connected to ollama server')
|
16 |
-
else:
|
17 |
-
print('Failed to connect to ollama server')
|
18 |
-
except requests.exceptions.RequestException as e:
|
19 |
-
print(f'Error: could not connect to ollama server - {str(e)}')
|
20 |
-
|
21 |
-
connect_to_ollama()
|
22 |
|
23 |
@app.get("/custom-auth")
|
24 |
async def custom_auth():
|
@@ -45,10 +34,9 @@ async def on_chat_start():
|
|
45 |
|
46 |
)
|
47 |
|
|
|
|
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
msg = "Help me with some questions"
|
53 |
-
lr.ChainlitTaskCallbacks(task)
|
54 |
-
await task.run_async(msg)
|
|
|
8 |
import chainlit as cl
|
9 |
import requests
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
@app.get("/custom-auth")
|
13 |
async def custom_auth():
|
|
|
34 |
|
35 |
)
|
36 |
|
37 |
+
agent = lr.ChatAgent(lr.ChatAgentConfig(llm=lm_config))
|
38 |
+
task = lr.Task(agent, interactive=True)
|
39 |
|
40 |
+
msg = "Help me with some questions"
|
41 |
+
lr.ChainlitTaskCallbacks(task)
|
42 |
+
await task.run_async(msg)
|
|
|
|
|
|