Spaces:
Sleeping
Sleeping
File size: 909 Bytes
516495b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import asyncio
from idreamers.api.calculation import calculation_router
from idreamers.api.calculation.openai_request import calculate_scores
from idreamers.api.calculation.schemas import PilotRequest, PilotResponse
from idreamers.api.calculation.utils import calculate_pilot_axes
from idreamers.core.wrappers import PilotResponseWrapper
@calculation_router.post('/pilot/calculate')
async def calculate_pilot(
data: PilotRequest
) -> PilotResponseWrapper[PilotResponse]:
depend_business, competitive, depend_supplier, critical_supplier = await asyncio.gather(
calculate_scores(data, 'business'),
calculate_scores(data, 'competitive'),
calculate_scores(data, 'supplier'),
calculate_scores(data, 'critical'),
)
response = calculate_pilot_axes(depend_business, competitive, depend_supplier, critical_supplier)
return PilotResponseWrapper(data=response)
|