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
Latihan ini adalah bagian dari kursus
Deploying AI into Production with FastAPI
Latihan interaktif praktis
Ubah teori menjadi tindakan dengan salah satu latihan interaktif kami.
Mulai berolahraga