Secure the API endpoint
You have a sentiment analysis model API that needs to be protected with API key authentication.
You've already set up the verify_api_key function, and now you need to create a protected endpoint that accepts the request with text input and returns predictions from the model. This endpoint should only be accessible to users with valid API keys.
You will be working within main.py to complete this exercise.
All the supporting code including verify_api_key and model loading is in model.py
Questo esercizio fa parte del corso
Deploying AI into Production with FastAPI
Esercizio pratico interattivo
Passa dalla teoria alla pratica con uno dei nostri esercizi interattivi
Inizia esercizio