File size: 485 Bytes
2bbef1e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## backend code
from fastapi import FastAPI
from app.schemas import WeatherInput
from app.predictor import predict_weather
app = FastAPI(title="Thunderstrom Prediction API")
# to ensure app is running
@app.get("/")
def home():
return {"message": "Weather Prediction API is running"}
# microservice
@app.post("/predict")
def predict(data: WeatherInput):
features = data.to_list()
result = predict_weather(features) # prob , pred
return result
|