BaşlayınÜcretsiz Başlayın

Sharing model parameters with monitoring

You would like to add a health check endpoint that provides model parameters to your penguin classification API.

The required packages (FastAPI and joblib) have been already imported.

Bu egzersiz

Deploying AI into Production with FastAPI

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Add a GET endpoint at the typical location for health checks.
  • Capture the model parameters from the sklearn model using the get_params method.
  • Include the model parameters in the response as the value to key params.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

model = joblib.load(
    'penguin_classifier.pkl'
)
app = FastAPI()

# Create health check endpoint
@app.get("____")
async def get_health():
    # Capture the model params
    params = ____.get_params()
    return {"status": "OK",
            # Include model params in response
            "params": ____}
Kodu Düzenle ve Çalıştır