Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
from fastapi import APIRouter, HTTPException
|
2 |
-
from fastapi import FastAPI
|
3 |
from pydantic import BaseModel
|
4 |
from pathlib import Path
|
5 |
import os
|
@@ -20,11 +19,13 @@ os.environ["TOGETHER_AI_API"] = "1c27fe0df51a29edee1bec6b4b648b436cc80cf4ccc36f5
|
|
20 |
# Ensure proper cache directory is available for models
|
21 |
os.environ['TRANSFORMERS_CACHE'] = '/tmp/cache'
|
22 |
|
23 |
-
# Initialize FastAPI
|
24 |
-
router = APIRouter() # Define router here first
|
25 |
app = FastAPI()
|
26 |
|
27 |
-
#
|
|
|
|
|
|
|
28 |
app.include_router(router)
|
29 |
|
30 |
bot_name = "LawGPT"
|
@@ -153,3 +154,5 @@ async def chat(request: ChatRequest):
|
|
153 |
@router.get("/")
|
154 |
async def root():
|
155 |
return {"message": "LawGPT API is running."}
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI, APIRouter, HTTPException
|
|
|
2 |
from pydantic import BaseModel
|
3 |
from pathlib import Path
|
4 |
import os
|
|
|
19 |
# Ensure proper cache directory is available for models
|
20 |
os.environ['TRANSFORMERS_CACHE'] = '/tmp/cache'
|
21 |
|
22 |
+
# Initialize FastAPI app
|
|
|
23 |
app = FastAPI()
|
24 |
|
25 |
+
# Initialize FastAPI Router
|
26 |
+
router = APIRouter()
|
27 |
+
|
28 |
+
# Include the router in the app
|
29 |
app.include_router(router)
|
30 |
|
31 |
bot_name = "LawGPT"
|
|
|
154 |
@router.get("/")
|
155 |
async def root():
|
156 |
return {"message": "LawGPT API is running."}
|
157 |
+
|
158 |
+
# Make sure the router is included and FastAPI will handle the paths.
|