Spaces:
Running
Running
from fastapi import FastAPI | |
import joblib | |
import pandas as pd | |
app = FastAPI() | |
model = joblib.load('ModelV2.joblib') | |
async def predict(data: dict): | |
df = pd.DataFrame([data]) | |
prediction = model.predict(df) | |
return {"prediction": prediction.tolist()} | |
async def root(): | |
return {"message": "NPK Needs Prediction API"} |