from typing import List

from fastapi import APIRouter, Request, Depends

from ..models import Prediction, Features
from ..predictor import HeartDissPredictor

predict_router = APIRouter()


def get_model(request: Request):
    return request.state.model


@predict_router.post("/predict", response_model=List[Prediction])
async def predict(features: Features, model: HeartDissPredictor = Depends(get_model)):
    return model.predict(features)

5129db58a6a9d8d47a32dc59f26d790e835913bc
<mask token>


def get_model(request: Request):
    return request.state.model


<mask token>

<mask token>


def get_model(request: Request):
    return request.state.model


@predict_router.post('/predict', response_model=List[Prediction])
async def predict(features: Features, model: HeartDissPredictor=Depends(
    get_model)):
    return model.predict(features)

<mask token>
predict_router = APIRouter()


def get_model(request: Request):
    return request.state.model


@predict_router.post('/predict', response_model=List[Prediction])
async def predict(features: Features, model: HeartDissPredictor=Depends(
    get_model)):
    return model.predict(features)

from typing import List
from fastapi import APIRouter, Request, Depends
from ..models import Prediction, Features
from ..predictor import HeartDissPredictor
predict_router = APIRouter()


def get_model(request: Request):
    return request.state.model


@predict_router.post('/predict', response_model=List[Prediction])
async def predict(features: Features, model: HeartDissPredictor=Depends(
    get_model)):
    return model.predict(features)

from typing import List

from fastapi import APIRouter, Request, Depends

from ..models import Prediction, Features
from ..predictor import HeartDissPredictor

predict_router = APIRouter()


def get_model(request: Request):
    return request.state.model


@predict_router.post("/predict", response_model=List[Prediction])
async def predict(features: Features, model: HeartDissPredictor = Depends(get_model)):
    return model.predict(features)
