Spaces:
Build error
Build error
Update backend/app.py
Browse files- backend/app.py +13 -2
backend/app.py
CHANGED
@@ -6,8 +6,19 @@ from fastapi.responses import JSONResponse
|
|
6 |
from chainlit.auth import create_jwt
|
7 |
from chainlit.server import app
|
8 |
import chainlit as cl
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
@app.get("/custom-auth")
|
13 |
async def custom_auth():
|
|
|
6 |
from chainlit.auth import create_jwt
|
7 |
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('http://localhost: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():
|