Files
WebApi/webapi/blueprints/tea.py
T
Roberto Treviño Cervantes c1444e2b8d initial commit
2026-09-21 10:23:40 -06:00

24 lines
625 B
Python

from flask import Blueprint, jsonify
from models.tea import TeaModel
from persistance.tea import pacientes_repository
tea_bp = Blueprint("tea", __name__)
@tea_bp.get("/pacientes/<string:pac_id>")
def get_paciente(pac_id: str):
paciente = pacientes_repository.get(pac_id)
if paciente is None:
return jsonify({"error": "not found"}), 404
return jsonify(paciente.model_dump())
@tea_bp.post("/predict")
def predict():
model = TeaModel()
try:
return jsonify({"prediction": model.predict(data=None)})
except NotImplementedError as exc:
return jsonify({"error": str(exc)}), 501