-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (24 loc) · 832 Bytes
/
Copy pathmain.py
File metadata and controls
30 lines (24 loc) · 832 Bytes
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
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api.predict import router as predict_router
from app.api.admin import router as admin_router
app = FastAPI(
title="SoilScan Sentinel-2 API",
description=(
"Accepts a GIS polygon, queries locally downloaded Sentinel-2 band data "
"and SoilGrids soil priors, and returns soil nutrient predictions "
"(N, P, K, pH) using trained Random Forest / SVM classifiers."
),
version="1.0.0",
)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_methods=["GET", "POST"],
allow_headers=["*"],
)
app.include_router(predict_router, tags=["Inference"])
app.include_router(admin_router, tags=["Admin"])
@app.get("/health", tags=["Health"])
async def health():
return {"status": "ok"}