This is a FastAPI-based web application designed to help users learn the ancient Brahmi script. It provides an interactive learning experience through structured character lessons, multiple-choice quizzes, progress tracking, and an integrated AI assistant powered by a local LLM.
-
Script Lessons (
/lesson): A reference page mapping Brahmi characters to their Devanagari counterparts and phonetic sounds. -
Interactive Quizzes (
/quiz/{number}): Test your knowledge with three different quiz modes: -
Quiz 1: Translate Brahmi characters to Devanagari.
-
Quiz 2: Identify the correct Brahmi character based on its phonetic sound.
-
Quiz 3: Translate common Devanagari vocabulary (fruits, cities, seasons, etc.) into Brahmi.
-
Progress Dashboard (
/progress): Uses a local SQLite database (progress.db) to track and display your latest scores across all quiz types. -
AI Helper (
/llm_helper): An interactive chatbot powered by a local Ollama model (gemma3:270m) that can answer questions about the script and provide guided help. Markdown responses are supported for rich text formatting. -
Brahmi Converter (
/brahmi_converter): A dedicated interface for converting text (implementation relies on the corresponding frontend template).
Before running this application, ensure you have the following installed:
- Python 3.7+
- Ollama: Installed and running locally. You must pull the specified model before using the LLM helper:
ollama run gemma3:270m
- Clone or download the project files.
- Install the required Python packages:
pip install fastapi uvicorn jinja2 python-multipart markdown
Ensure your project directory is organized as follows for the application to serve the frontend correctly:
your_project_folder/
│
├── main.py # The main FastAPI application code provided above
├── progress.db # Auto-generated SQLite database for scores
├── static/ # Directory for static assets (CSS, JS, images)
└── templates/ # Directory for Jinja2 HTML templates
├── welcome.html
├── lesson.html
├── progress.html
├── quiz_start.html
├── quiz_question.html
├── quiz_result.html
├── llm_helper.html
└── brahmi_converter.html
- Open your terminal and navigate to the directory containing your script (e.g.,
main.py). - Start the FastAPI server using Uvicorn:
uvicorn main:app --reload
- Open your web browser and navigate to:
http://127.0.0.1:8000/
The application automatically initializes an SQLite database (progress.db) upon startup if it does not already exist. It creates a results table with the following schema to log quiz sessions:
id(INTEGER, Primary Key)quiz_type(TEXT)score(INTEGER)timestamp(TEXT)