File size: 637 Bytes
c82e328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from fastapi import FastAPI
import os
import sys
src_directory = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..", "src"))
sys.path.append(src_directory)
from modules import logistic_regression

app = FastAPI()

@app.get("/")
def home():
    return {"message": "Welcome to Prediction Hub"}

@app.get("/predict")
def display_prediction(message : str = "Hello World"):
    try:
        dimention = logistic_regression.get_label(message)
        # dimention = message
        return {"message" : dimention}
    except Exception as e:
        return f"Unable to fetch the data {e}"

# x = display_prediction()
# print(type(x))