AIEVAL is an innovative full-stack application designed to automate and streamline the evaluation of answer sheets and assignments. By leveraging cutting-edge AI technologies for text extraction and content similarity scoring, it helps educators quickly and efficiently score student submissions against a reference answer sheet, providing valuable feedback and significantly reducing manual grading effort.
- Reference Answer Sheet Upload: Teachers can easily upload a reference answer sheet in various document formats (e.g., images, PDFs).
- Student Answer Sheet Upload: Students (or teachers on their behalf) can upload individual answer sheets.
- Automated Text Extraction: Utilizes Google Vision API for highly accurate Optical Character Recognition (OCR) to extract text from uploaded images or PDF documents.
- Semantic Similarity Scoring:
- SBERT (Sentence-BERT): Compares the semantic similarity between student answers and reference answers using pre-trained SBERT models, providing a quantitative measure of content overlap.
- Gemini API: Leverages the advanced capabilities of Google's Gemini API for more sophisticated and nuanced content comparison, enabling a deeper understanding of the answers and potentially qualitative feedback generation.
- Detailed Score Generation: Generates a comprehensive score for each student's submission, indicating how closely their answers align with the reference, along with potential breakdowns.
- User-Friendly Interface: Built with Next.js and ShadCN, the frontend provides a responsive and intuitive experience for uploading files, managing evaluations, and viewing results.
AIEVAL follows a client-server architecture with a clear separation between the frontend and the backend.
- Frontend (
frontend/folder): Developed with Next.js, this is the user-facing part of the application. It handles user interactions, displays information, and communicates with the backend via API calls. - Backend (
backend/folder): Developed with Python, this serves as the API server. It is responsible for:- Receiving file uploads from the frontend.
- Performing semantic similarity calculations using SBERT and Gemini API.
- Exposing RESTful API endpoints for the frontend to consume.
- Next.js: React framework for building fast and scalable web applications, supporting server-side rendering (SSR) and static site generation (SSG).
- React: JavaScript library for building user interfaces.
- TypeScript: For type safety and better code maintainability.
- Tailwind CSS: For utility-first CSS styling.
- Axios/Fetch API: For making HTTP requests to the Python backend.
- Python: The core programming language for backend logic.
sentence-transformerslibrary: For SBERT embeddings.google-generativeailibrary: For interacting with Google Gemini API.- Database (DynamoDB): For persistent storage of reference answers, student submissions, and evaluation results.
To get a local copy up and running, follow these simple steps.
- Node.js (LTS version recommended) and npm or yarn for the Next.js frontend.
- Python 3.8+ and pip for the Python backend.
-
Clone the repository:
git clone https://github.com/ElegantFalcon/AIEVAL.git cd AIEVAL -
Backend Setup (
backend/)cd backend python -m venv venv source venv/bin/activate # On Windows: `venv\Scripts\activate` pip install -r requirements.txt
-
Frontend Setup (
frontend/)cd ../frontend npm install
This project requires API keys for Google Vision and Google Gemini.
-
Google Cloud Project:
- Create a Google Cloud Project if you don't have one.
- Enable the Google Vision API and Gemini API within your project.
- For Google Vision: Create a service account key (JSON file) and download it.
- For Gemini API: Generate an API key.
-
Environment Variables:
- Backend (
backend/.env): Create a.envfile in thebackenddirectory.(Make sure your backend code uses a library likeGOOGLE_APPLICATION_CREDENTIALS=/path/to/your/google-cloud-service-account.json GEMINI_API_KEY="YOUR_GEMINI_API_KEY"python-dotenvto load these variables.) - Frontend (
frontend/.env.local): Create a.env.localfile in thefrontenddirectory.(Next.js automatically loadsNEXT_PUBLIC_BACKEND_URL=http://localhost:5000.env.localvariables prefixed withNEXT_PUBLIC_.)
- Backend (
-
Start the Backend Server (
backend/) From thebackenddirectory:source venv/bin/activate `uvicorn main:app --reload`
The backend server will typically run on
http://localhost:5000(or another configured port). -
Start the Frontend Development Server (
frontend/) From thefrontenddirectory:npm run dev
The Next.js application will typically be accessible via
http://localhost:3000. -
Interact with AIEVAL:
- Open your browser and navigate to
http://localhost:3000. - Use the interface to upload reference answer sheets and student submissions.
- Initiate the evaluation process through the UI.
- View the generated scores and feedback on the frontend.
- Open your browser and navigate to
- User Interaction (Next.js Frontend): The user uploads documents (images/PDFs) through the web interface.
- File Upload to Backend: The Next.js frontend sends the uploaded files as
FormDatato a designated API endpoint on the Python backend. - Text Extraction (Python Backend + Google Vision API):
- The Python backend receives the files.
- It uses the Google Cloud Vision API client library to send the image/PDF data to the Google Vision service.
- Google Vision performs OCR and returns the extracted text.
- Semantic Comparison (Python Backend + SBERT/Gemini API):
- The extracted text from the reference answer and each student's answer is processed.
- SBERT: Sentence embeddings are generated for key sections or sentences using the
sentence-transformerslibrary. Cosine similarity is then calculated between these embeddings to quantify the semantic overlap. - Gemini API: For more sophisticated analysis, the backend constructs prompts to the Gemini API, providing both the reference answer and the student's answer. Gemini can then generate a score, identify discrepancies, or even provide natural language feedback based on its understanding.
- Score Aggregation and Storage (Python Backend): The similarity scores (from SBERT, Gemini, or a combination, possibly weighted) are aggregated to produce a final score for each student's submission. This data, along with metadata, is then stored in the database.
- Result Retrieval and Display (Next.js Frontend): The Next.js frontend fetches the evaluation results from the Python backend's API and displays them in a user-friendly format.