Spaces:
Sleeping
Sleeping
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 | |
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) | |