{"id":50410968,"url":"https://github.com/rusiru-erandaka/personality-api","last_synced_at":"2026-05-31T03:31:06.362Z","repository":{"id":357420994,"uuid":"1232529466","full_name":"rusiru-erandaka/personality-api","owner":"rusiru-erandaka","description":"This is an human personality classifier application build with Gradient Boosting algorithm and FastAPI backend. the project has deployed on the Vercel","archived":false,"fork":false,"pushed_at":"2026-05-12T17:06:29.000Z","size":513,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-12T19:10:24.146Z","etag":null,"topics":["fastapi","gradient-boosting","random-forest-classifier","regression-models","xgboost-classifier"],"latest_commit_sha":null,"homepage":"https://personality-opal.vercel.app","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rusiru-erandaka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-08T02:50:06.000Z","updated_at":"2026-05-12T17:12:24.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rusiru-erandaka/personality-api","commit_stats":null,"previous_names":["rusiru-erandaka/personality-api"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/rusiru-erandaka/personality-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusiru-erandaka%2Fpersonality-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusiru-erandaka%2Fpersonality-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusiru-erandaka%2Fpersonality-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusiru-erandaka%2Fpersonality-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rusiru-erandaka","download_url":"https://codeload.github.com/rusiru-erandaka/personality-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusiru-erandaka%2Fpersonality-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33718446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","gradient-boosting","random-forest-classifier","regression-models","xgboost-classifier"],"created_at":"2026-05-31T03:31:05.705Z","updated_at":"2026-05-31T03:31:06.353Z","avatar_url":"https://github.com/rusiru-erandaka.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Personality Classifier API\n\nPredicts **Introvert / Extrovert** personality from behavioural features.  \nBuilt with FastAPI · Deployed on Vercel.\n\n---\n\n## Folder Structure\n\n```\npersonality-api/\n├── app/\n│   ├── __init__.py\n│   ├── main.py            # FastAPI app + middleware\n│   ├── model_loader.py    # Loads model.pkl once at startup\n│   ├── schemas.py         # Pydantic request/response models\n│   └── routers/\n│       ├── __init__.py\n│       ├── health.py      # GET /health\n│       └── predict.py     # POST /predict\n├── model/\n│   └── model.pkl          # ← place your trained model here\n├── .gitignore\n├── requirements.txt\n├── run.py                 # Local dev server\n├── vercel.json            # Vercel deployment config\n└── README.md\n```\n\n---\n\n## Setup — Local Development\n\n```bash\n# 1. Clone / download the project\ncd personality-api\n\n# 2. Create a virtual environment\npython -m venv venv\nsource venv/bin/activate      # Windows: venv\\Scripts\\activate\n\n# 3. Install dependencies\npip install -r requirements.txt\n\n# 4. Drop your model.pkl into the model/ folder\n#    (exported from the Colab training notebook)\n\n# 5. Run the dev server\npython run.py\n# → http://localhost:8000/docs   (Swagger UI)\n# → http://localhost:8000/redoc  (ReDoc)\n```\n\n---\n\n## API Endpoints\n\n### `GET /health`\nReturns API status and model load confirmation.\n\n```json\n{\n  \"status\": \"ok\",\n  \"model_loaded\": true,\n  \"version\": \"1.0.0\"\n}\n```\n\n---\n\n### `POST /predict`\nClassifies a person as Introvert or Extrovert.\n\n**Request body** (all fields optional — missing values are imputed):\n\n```json\n{\n  \"Time_spent_Alone\": 7.0,\n  \"Stage_fear\": \"Yes\",\n  \"Social_event_attendance\": 2.0,\n  \"Going_outside\": 2.0,\n  \"Drained_after_socializing\": \"Yes\",\n  \"Friends_circle_size\": 3.0,\n  \"Post_frequency\": 2.0\n}\n```\n\n**Response:**\n\n```json\n{\n  \"personality\": \"Introvert\",\n  \"confidence\": 0.9213,\n  \"probabilities\": {\n    \"Extrovert\": 0.0787,\n    \"Introvert\": 0.9213\n  }\n}\n```\n\n**Field reference:**\n\n| Field | Type | Range | Description |\n|---|---|---|---|\n| `Time_spent_Alone` | float | 0–11 | Avg hours alone per day |\n| `Stage_fear` | string | Yes / No | Experiences stage fright |\n| `Social_event_attendance` | float | 0–10 | Social event frequency |\n| `Going_outside` | float | 0–7 | Goes outside frequency |\n| `Drained_after_socializing` | string | Yes / No | Feels drained after social interaction |\n| `Friends_circle_size` | float | 0–15 | Number of close friends |\n| `Post_frequency` | float | 0–10 | Social media post frequency |\n\n---\n\n## Deploy to Vercel\n\n```bash\n# 1. Install Vercel CLI\nnpm install -g vercel\n\n# 2. Login\nvercel login\n\n# 3. Deploy (from project root)\nvercel\n\n# 4. For production deployment\nvercel --prod\n```\n\n\u003e **Important:** Make sure `model/model.pkl` is committed to the repo before deploying.  \n\u003e The file is typically ~1–5 MB which is well within Vercel's 50 MB lambda limit.\n\n---\n\n## Test with curl\n\n```bash\ncurl -X POST https://personality-opal.vercel.app/predict \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"Time_spent_Alone\": 7.0,\n  \"Stage_fear\": \"Yes\",\n  \"Social_event_attendance\": 2.0,\n  \"Going_outside\": 2.0,\n  \"Drained_after_socializing\": \"Yes\",\n  \"Friends_circle_size\": 3.0,\n  \"Post_frequency\": 2.0\n}'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusiru-erandaka%2Fpersonality-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frusiru-erandaka%2Fpersonality-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusiru-erandaka%2Fpersonality-api/lists"}