File size: 1,065 Bytes
081c5aa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
26
27
28
29
30
31
32
33
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}