File size: 426 Bytes
4c55ce6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from fastapi import FastAPI
from pydantic import BaseModel

from app.predictor import predict_cluster

app = FastAPI()

class LogInput(BaseModel):
    log_text: str


@app.get("/")
def root():
    return {"status": "RTL Log API running"}


@app.post("/analyze_log")
def analyze_log(data: LogInput):

    result = predict_cluster(data.log_text)

    return {
        "input_log": data.log_text,
        "analysis": result
    }