๐ง CrimsonLearn (CrimsonMind API)
Backend
CrimsonLearn Backend powers CrimsonMind, an AI-driven study assistant that transforms static notes into interactive learning through OCR, quizzes, and contextual explanations.
This backend exposes a REST API that the frontend consumes to provide a seamless learning experience.
โจ Features
๐ OCR Processing โ Extracts text from uploaded handwritten or typed notes
๐ง AI Tutor (CrimsonMind) โ Answers questions strictly based on provided notes
๐ Quiz Generator โ Creates MCQs from notes for active recall
๐ Frontend-ready API โ Designed to integrate with a React/Vite frontend
๐ ๏ธ Tech Stack
Backend Framework: Flask
AI Model: Google Gemini
OCR: Tesseract OCR + Pillow
Language: Python 3
Environment Management: python-dotenv
๐ Project Structure backend/ โ โโโ app.py # Flask app & routes โโโ chatbot.py # CrimsonMind AI logic โโโ quiz.py # Quiz generation logic โโโ ocr.py # OCR text extraction โโโ requirements.txt # Python dependencies โโโ .env # API keys (not committed) โโโ uploads/ # Uploaded note images
๐ API Endpoints ๐ Upload Notes (OCR)
POST /api/upload
Input: Image file (PNG/JPG)
Output: Extracted text
๐ Generate Quiz
POST /api/generateQuiz
{ "notes": "your notes here", "num_questions": 5 }
๐ง Ask CrimsonMind
POST /api/chat
{ "notes": "your notes here", "question": "your question here" }
โ๏ธ Setup Instructions 1๏ธโฃ Clone & Navigate git clone https://github.com/AdarshAlex751/crimsonmind cd backend
2๏ธโฃ Create Virtual Environment python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
3๏ธโฃ Install Dependencies pip install -r requirements.txt
4๏ธโฃ Configure Environment
Create a .env file:
GEMINI_API_KEY=your_api_key_here
5๏ธโฃ Run the Server python app.py
Server runs on:
๐ Purpose
This backend focuses on conceptual learning, ensuring AI responses stay grounded in the userโs own study material rather than generic explanations.
Frontend
Built with performance and clean UI in mind.
โจ Features
๐ Upload notes for OCR processing
๐ง Chat with CrimsonMind AI
๐ Generate quizzes instantly
๐จ Smooth animations & modern UI
๐ Automatic dark/light mode
๐ ๏ธ Tech Stack
Framework: React (Vite)
Styling: Tailwind CSS
Animations: Framer Motion
Icons: Lucide React
HTTP Client: Axios
๐ Project Structure frontend/ โ โโโ index.html โโโ src/ โ โโโ main.jsx โ โโโ App.jsx โ โโโ components/ โโโ tailwind.config.js โโโ postcss.config.js โโโ vite.config.js โโโ package.json โโโ package-lock.json
โ๏ธ Setup Instructions 1๏ธโฃ Navigate to Frontend cd frontend
2๏ธโฃ Install Dependencies npm install
3๏ธโฃ Start Development Server npm run dev
Frontend runs at:
The frontend is preconfigured to proxy API requests to the Flask backend.
๐ Backend Connection
The frontend communicates with the backend via:
/api โ http://127.0.0.1:5000
Make sure the backend server is running before using the app.
๐ฏ Design Philosophy
Minimal distractions
Fast feedback loops
Learning through interaction, not passive reading
๐ฎ Future Improvements
User authentication
Study progress tracking
Concept graphs & analytics
PDF and multi-page uploads
Voice-based interaction