Spaces:
Running
Running
File size: 367 Bytes
1bb18f1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from fastapi import FastAPI
import joblib
import pandas as pd
app = FastAPI()
model = joblib.load('ModelV2.joblib')
@app.post("/predict")
async def predict(data: dict):
df = pd.DataFrame([data])
prediction = model.predict(df)
return {"prediction": prediction.tolist()}
@app.get("/")
async def root():
return {"message": "NPK Needs Prediction API"} |