Module 02 of 06 · Outline
Building AI Apps with FastAPI, Streamlit & Gradio
Turn a model interaction into an API and a usable interface.
Learning outcome: An AI application prototype with validated requests and a working demonstration interface.
Lesson outline
Lesson 2.1
FastAPI application design
- Request and response models with Pydantic
- Async endpoints and error handling
- Local API documentation and endpoint tests
Lesson 2.2
Interactive demos
- Streamlit input widgets and session state
- Gradio interfaces and chat history
- Choosing an interface for your use case
Lesson 2.3
Streaming and file pipelines
- Streaming responses and cancellation
- Validating file types and upload size
- Separating UI, application logic, and model adapters
Practice assignment
Build a document-summary prototype
- Create a validated summary endpoint using a mock model.
- Connect a Streamlit or Gradio interface.
- Handle empty text, oversized input, and a simulated model timeout.
Deliverable: Source code, a local demo, and tests for the three failure cases.
Independent practice · no submission or grading