Download app.py from AniaAri/pregunta05: direct link, hf CLI and curl.
- Browser
- Download file 327 Bytes
-
https://huggingface.co/AniaAri/pregunta05/resolve/main/app.py
- Command line
-
hf download hf://AniaAri/pregunta05/app.py
-
curl -L -o app.py https://huggingface.co/AniaAri/pregunta05/resolve/main/app.py
327 Bytes
| from fastapi import FastAPI | |
| import pandas as pd | |
| import joblib | |
| app = FastAPI() | |
| # Cargar el modelo entrenado | |
| model = joblib.load("model.joblib") | |
| def predict(data: dict): | |
| df = pd.DataFrame([data]) | |
| df = pd.get_dummies(df) | |
| prediction = model.predict(df) | |
| return {"prediction": prediction[0]} | |