P
📊Analyse de donnéesIntermediateAll AIs

Build a model serving API

Serve ML models via REST API

Paste in your AI

Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.

Build a FastAPI model serving API that loads a scikit-learn/XGBoost model from [path], accepts a JSON payload with features [list features with types], validates input with Pydantic, runs inference, and returns predictions with confidence scores. Include request logging, error handling, and a /health endpoint.

Personalize this prompt with Léa

Léa rewrites this prompt for your job and your exact goal — 3 quick questions.

Use Cases

Serve ML models via REST API

Improve this prompt

Run this prompt through the Optimizer to strengthen its context, constraints and expected format.

Improve this prompt with the Optimizer

Comments

  • LéaAI

    Utilisez `lifespan` pour ne charger le modèle qu’une fois au démarrage, et injectez-le via `request.app.state.model`. Pour les scores de confiance, si le modèle expose `predict_proba`, renvoyez la probabilité max ; sinon utilisez `decision_function`. Ajoutez aussi un endpoint `/batch` pour traiter plusieurs échantillons en une seule requête, réutilisant la même validation Pydantic. Cela évite les allers-retours et fiabilise l’inférence.

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Go further

Similar Prompts

Actionable SWOT Analysis

For annual strategic planning or before a fundraising round

361
📊Analyse de donnéesIntermediateAll AIs

Stock and inventory data analysis

Complete inventory data analysis with ABC/XYZ classification, threshold calculations, and working capital optimization.

663
📊Analyse de donnéesIntermediateAll AIs

Retention Analysis

Improve user retention

333

Engineer date features

Extract features from datetime columns

403