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 encoding_model app = FastAPI() @app.get("/") def home(): encoding_model.train_model() return {"message": "Welcome to Prediction Hub"} @app.get("/predict") def display_prediction(message : str = "Hello World"): try: dimention = encoding_model.get_label(message) return dimention except Exception as e: return f"Unable to fetch the data {e}" # @app.post("/predict") # def post_messsage(message, response_model ): # logistic_regression.create_embending(message)