logic-center / routes /confidence.py
camphong24032002
Test
6b95d78
raw
history blame contribute delete
598 Bytes
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()