File size: 407 Bytes
c407b02
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from fastapi import FastAPI
from src.pipeline.run_pipeline_updated import run_pipeline

app = FastAPI()


@app.get("/")
def root():
    return {"message": "SmartMatch API running"}


@app.get("/match")
def match(text: str):

    results = run_pipeline(text)

    # handle different pipeline outputs safely
    if isinstance(results, list):
        return {"results": results}

    return {"output": results}