Spaces:
Running
Running
File size: 598 Bytes
6b95d78 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
from models.resup import ResSupPayload
from fastapi import status, APIRouter
from services.resup import ResSupCluster
from typing import List
import pandas as pd
import json
router = APIRouter()
@router.post(
"/resup",
name="Get lines of Resistance and Support",
status_code=status.HTTP_200_OK
)
async def get_resup_line(payload: ResSupPayload) -> List[float]:
data = pd.DataFrame(json.loads(payload.data))
cluster = ResSupCluster(
data=data,
feature_map=payload.feature_map,
n_clusters=payload.n_clusters
)
return cluster.extract_all_lines()
|