Spaces:
Sleeping
Sleeping
File size: 668 Bytes
059c0a6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
from fastapi import FastAPI
from train import train_model
from predict import predict_labels
from test import test_model
from validate import validate_files
from schemas import TransactionData
app = FastAPI(title="LogReg Multi-Output Classifier API")
@app.post("/train")
def train():
result = train_model()
return {"message": "Model trained and saved successfully", "accuracy": result}
@app.post("/predict")
def predict(input_data: TransactionData):
prediction = predict_labels(input_data)
return {"predictions": prediction}
@app.post("/test")
def test():
return test_model()
@app.post("/validate")
def validate():
return validate_files()
|