File size: 777 Bytes
c2d58b3
 
 
 
 
80d1ded
b712ab3
80d1ded
c2d58b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b712ab3
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
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from routers import inference, training
from huggingface_hub import login
from config import settings
import os
# login(settings.huggingface_key)
login(os.getenv("HUGGINGFACE_KEY"))

app = FastAPI(openapi_url="/api/v1/sparrow-ml/openapi.json", docs_url="/api/v1/sparrow-ml/docs")

app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_methods=["*"],
    allow_headers=["*"],
    allow_credentials=True,
)

app.include_router(inference.router, prefix="/api-inference/v1/sparrow-ml", tags=["Inference"])
app.include_router(training.router, prefix="/api-training/v1/sparrow-ml", tags=["Training"])


@app.get("/")
async def root():
    return {"message": "Naivas GRN inferencing"}