from typing import Union from src.utils import make_incredible_predictions from fastapi import FastAPI app = FastAPI() # /docs, page to see auto-generated API documentation @app.get("/") def read_root(): return {"Hello": "World", "cohort": "2"} @app.get("/items/{item_id}") def read_item(item_id: int, q: Union[str, None] = None): return {"item_id": item_id, "q": q} @app.get("/predict") def predict(age, salary, dependentsNumber, gender): prediction = None # prediction = model.predict(pd.DataFrame([age, salary, dependents_number, gender])) return {"age":age, "salary":salary, "dependents_number":dependentsNumber, "gender":gender,"prediction":prediction} @app.post("/predict") def predict(age, salary, dependentsNumber, gender): prediction = None # prediction = model.predict(pd.DataFrame([age, salary, dependents_number, gender])) return {"age":age, "salary":salary, "dependents_number":dependentsNumber, "gender":gender,"prediction":prediction}