📚 Course contents
AI & Computer Vision, lesson 34 of 52
Flask API: The Python to JavaScript Bridge
Introduction
Your detector lives in Python; your dashboard lives in the browser. They can't call each other directly, so today you'll build the waiter between the kitchen and the dining room: a small Flask API. The page asks a question with a web address, Python answers with JSON, and both sides can be built and tested separately.
By the end of this lesson you'll be able to:
- Explain why Python and the browser need an API between them
- Write Flask routes that answer with JSON
- Choose GET or POST correctly, and return meaningful status codes
- Reuse the lesson 31 detector behind the API without changing it
- Test an API with Flask's test client, including the error cases
- Name three limits of the design (single user, polling, open CORS)

