Back to Blog

FastAPI / Plotly / Education

An Interactive Quadratic Function Widget for Classroom Demonstrations

A FastAPI and Plotly teaching widget for exploring quadratic functions.

This tool is a classroom-oriented quadratic function demo. A teacher can describe a scenario in natural language, the page turns it into function parameters, and students can keep adjusting the graph with sliders.

Project Overview

FastAPI serves the page and API from the same origin. Pydantic GraphSpec is the data contract, the rule parser and LLM generator produce candidate parameters, and Plotly renders the curve.

The widget turns a static formula into an interactive graph. It fits classroom trials, internal demos, parameter observation, and converting natural-language questions into function graphs.

Controlled Generation

Rule parsing runs first and recognizes common expressions, vertex form, and parameter descriptions. Only uncovered cases are passed to an OpenAI-compatible model. All results go through type checks and range limits before reaching Plotly.

The page recalculates the vertex, axis of symmetry, discriminant, and roots whenever a, b, or c changes.