Spaces:
Running
Running
File size: 1,035 Bytes
98caf15 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# 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"])
@app.get("/")
async def root():
return {"message": "Tool Endpoints"}
app.mount("/api/v1/static", StaticFiles(directory="static"), name="static")
|