Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -8,6 +8,7 @@ from datetime import datetime
|
|
8 |
|
9 |
from fastapi import FastAPI, File, UploadFile, HTTPException, Query, Depends
|
10 |
from fastapi.responses import FileResponse, StreamingResponse
|
|
|
11 |
|
12 |
from llm_initialization import get_llm
|
13 |
from embedding import get_embeddings
|
@@ -30,6 +31,13 @@ MONGO_CLUSTER_URL = os.getenv("CONNECTION_STRING")
|
|
30 |
|
31 |
app = FastAPI(title="VectorStore & Document Management API")
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
# Import auth router and dependencies
|
34 |
from auth import router as auth_router, get_current_user, users_collection
|
35 |
|
@@ -304,7 +312,6 @@ async def root():
|
|
304 |
"message": "Welcome to the EduLearn AI."
|
305 |
}
|
306 |
|
307 |
-
|
308 |
if __name__ == "__main__":
|
309 |
import uvicorn
|
310 |
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
|
8 |
|
9 |
from fastapi import FastAPI, File, UploadFile, HTTPException, Query, Depends
|
10 |
from fastapi.responses import FileResponse, StreamingResponse
|
11 |
+
from fastapi.staticfiles import StaticFiles # <-- Imported for serving static files
|
12 |
|
13 |
from llm_initialization import get_llm
|
14 |
from embedding import get_embeddings
|
|
|
31 |
|
32 |
app = FastAPI(title="VectorStore & Document Management API")
|
33 |
|
34 |
+
# ----- New: Setup avatars static file serving using absolute path -----
|
35 |
+
AVATAR_DIR = os.path.join(os.getcwd(), "avatars")
|
36 |
+
if not os.path.exists(AVATAR_DIR):
|
37 |
+
os.makedirs(AVATAR_DIR)
|
38 |
+
app.mount("/avatars", StaticFiles(directory=AVATAR_DIR), name="avatars")
|
39 |
+
# --------------------------------------------------------------------------
|
40 |
+
|
41 |
# Import auth router and dependencies
|
42 |
from auth import router as auth_router, get_current_user, users_collection
|
43 |
|
|
|
312 |
"message": "Welcome to the EduLearn AI."
|
313 |
}
|
314 |
|
|
|
315 |
if __name__ == "__main__":
|
316 |
import uvicorn
|
317 |
uvicorn.run(app, host="0.0.0.0", port=8000)
|