Student / README.md
3v324v23's picture
feat: add API endpoints and documentation
11c79a7
---
title: Student Personality Analysis
emoji: πŸŽ“
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false
---
# Student Personality Analysis
A web application to determine student personality traits based on academic grades.
## Features
- **Premium UI**: Glassmorphism design.
- **SQLite Database**: Persistent storage for history.
- **Dockerized**: specific for Hugging Face Spaces.
## πŸš€ How to Run Your Own Copy
### Method 1: Duplicate (Recommended)
Simply click the **Duplicate this Space** button in the settings menu of this Space to create your own copy in seconds.
### Method 2: Manual Deployment
1. Create a new Space on Hugging Face.
2. Select **Docker** as the SDK.
3. Upload these files to your Space.
4. The application will build and run automatically (Port 7860).
## πŸ“‘ API Documentation
You can interact with the application programmatically using the following JSON endpoints.
### 1. Analyze Student (`POST /api/analyze`)
Submit student marks to get grade and personality trait.
**Request:**
```json
POST /api/analyze
Content-Type: application/json
{
"name": "John Doe",
"sub1": 85,
"sub2": 90,
"sub3": 88
}
```
**Response:**
```json
{
"success": true,
"data": {
"name": "John Doe",
"average": 88,
"grade": "A",
"trait": "Extroverted"
}
}
```
### 2. Get Recent Students (`GET /api/students`)
Returns a list of the 10 most recently analyzed students.
**Response:**
```json
[
{
"id": 1,
"name": "Alice",
"subject1": 80,
"subject2": 85,
"subject3": 90
},
...
]
```
### 3. Get Rules (`GET /api/rules`)
Returns the grading rules and score ranges.
### 4. Get Traits (`GET /api/traits`)
Returns the mapping of grades to personality traits.