Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/Diagnostico.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def generar_explicacion(self, sesion):

self.explicacion = SALIDA

def generar_diagnostico(self):
async def generar_diagnostico(self):
"""
Genera el diagnóstico de los datos usando el modelo ONNX para normalizarlos
y luego clasificarlos
Expand Down
2 changes: 1 addition & 1 deletion app/routers/main_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def diagnosticar(req: PeticionDiagnostico, idioma: str = Depends(verificar
try:
DATOS = req.obtener_array_instancia()
DIAGNOSTICO = Diagnostico(DATOS)
RES = DIAGNOSTICO.generar_diagnostico()
RES = await DIAGNOSTICO.generar_diagnostico()

return JSONResponse(RES, status_code=200, media_type="application/json")
except Exception as e:
Expand Down
6 changes: 4 additions & 2 deletions tests/scripts/models/test_diagnostico.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
from onnxruntime import InferenceSession
from numpy import array, float32
from pathlib import Path
import pytest

def test_7():
@pytest.mark.asyncio
async def test_7():
"""
Test para validar que la clase cargue el modelo y genere un diagnóstico
correctamente.
Expand All @@ -12,7 +14,7 @@ def test_7():
68,1,0,0,0,0,0,0,1,0,1,0,0,0,1,18,91,112,110,70,0,0,0,0,6800,13,313400,0,1,1,0,0,0,1,1,0,1,0,0,0,0,0,0,0
],]).astype(float32)
OBJ = Diagnostico(INSTANCIA)
RES = OBJ.generar_diagnostico()
RES = await OBJ.generar_diagnostico()

assert RES["prediccion"] == True
assert round(RES["probabilidad"],0) == 1.0
Expand Down