Spaces:
Running
Running
# main.py | |
from fastapi import FastAPI | |
from fastapi.middleware.cors import CORSMiddleware | |
from fastapi.staticfiles import StaticFiles | |
from huggingface_hub import login | |
from config import settings | |
from routers import tool_bpy_doc, tool_gpu_checker, tool_calls, tool_find_related | |
login(settings.huggingface_key) | |
app = FastAPI(openapi_url="/api/v1/openapi.json", | |
docs_url="/api/v1/docs") | |
app.add_middleware( | |
CORSMiddleware, | |
allow_origins=["*"], | |
allow_methods=["*"], | |
allow_headers=["*"], | |
allow_credentials=True, | |
) | |
app.include_router( | |
tool_bpy_doc.router, prefix="/api/v1", tags=["Tools"]) | |
app.include_router( | |
tool_gpu_checker.router, prefix="/api/v1", tags=["Tools"]) | |
app.include_router( | |
tool_find_related.router, prefix="/api/v1", tags=["Tools"]) | |
app.include_router( | |
tool_calls.router, prefix="/api/v1", tags=["Function Calls"]) | |
async def root(): | |
return {"message": "Tool Endpoints"} | |
app.mount("/api/v1/static", StaticFiles(directory="static"), name="static") | |