{"id":18132690,"url":"https://github.com/younis-ali/photo-validation","last_synced_at":"2026-01-30T14:20:09.163Z","repository":{"id":229575868,"uuid":"775402396","full_name":"younis-ali/photo-validation","owner":"younis-ali","description":"Using the openCV models perform phot validation, face detection, age detection, and gender detection.","archived":false,"fork":false,"pushed_at":"2024-07-18T06:11:37.000Z","size":85007,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T10:10:24.792Z","etag":null,"topics":["age-detection","face-detection","fastapi","gender-detection","opencv"],"latest_commit_sha":null,"homepage":"","language":"Python","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/younis-ali.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}},"created_at":"2024-03-21T10:21:36.000Z","updated_at":"2024-08-11T11:44:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"e0d2a97a-bd3a-472a-8903-e49324f54994","html_url":"https://github.com/younis-ali/photo-validation","commit_stats":null,"previous_names":["younis-ali/photo-validation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/younis-ali/photo-validation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/younis-ali%2Fphoto-validation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/younis-ali%2Fphoto-validation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/younis-ali%2Fphoto-validation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/younis-ali%2Fphoto-validation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/younis-ali","download_url":"https://codeload.github.com/younis-ali/photo-validation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/younis-ali%2Fphoto-validation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28914049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T12:13:43.263Z","status":"ssl_error","status_checked_at":"2026-01-30T12:13:22.389Z","response_time":66,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["age-detection","face-detection","fastapi","gender-detection","opencv"],"created_at":"2024-11-01T13:05:18.616Z","updated_at":"2026-01-30T14:20:09.127Z","avatar_url":"https://github.com/younis-ali.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Photo Validation API\n\nThis FastAPI application allows users to upload a profile photo and validate the user's age and gender, with an optional age verification flag.\n\n## Features\n\n- Upload a profile photo\n- Validate user's age and gender\n- Optional age parameter, if given then age will be detected otherwise not\n\n## Requirements\n\n- Python 3.7+\n- FastAPI\n- Pydantic\n- Uvicorn\n\n## Installation\n\n1. Clone the repository:\n\n    ```bash\n    git clone https://github.com/yourusername/photo-validation.git\n    cd photo-validation\n    ```\n\n2. Create a virtual environment and activate it:\n\n    ```bash\n    python -m venv venv\n    source venv/bin/activate  # On Windows use `venv\\Scripts\\activate`\n    ```\n\n3. Install the required dependencies:\n\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n    The `requirements.txt` should include:\n    ```\n    fastapi\n    uvicorn\n    ```\n\n## Running the Application\n\n1. Start the FastAPI application using Uvicorn:\n\n    ```bash\n    uvicorn main:app --reload\n    ```\n\n    The endpoints will be available at `http://127.0.0.1:8000/docs`.\n\n## Usage\n\n### Endpoint: `/validate_profile_photo`\n\n**Method:** POST\n\n**Description:** Validate the user's profile photo, age, gender, and optionally verify the age.\n\n**Request:**\n  - `photo` (UploadFile): The profile photo file.\n  - `age` (int): The user's age optional.\n  - `gender` (str): The user's gender. Must be either \"Male\" or \"Female\".\n  - `slack` (bool): predicted age flexibility value. Default is `0.25`.\n\n**Example Request:**\n\n- When `age` is `Given`\n```bash\ncurl -X 'POST' \\\n  'http://127.0.0.1:8000/validate_profile_photo' \\\n  -H 'accept: application/json' \\\n  -H 'Content-Type: multipart/form-data' \\\n  -F 'age=42' \\\n  -F 'gender=' \\\n  -F 'slack=0.80' \\\n  -F 'photo=@photograph.jpg;type=image/jpeg'\n  ```\n  Resonse Body\n  ```json\n  {\n    \"response\": {\n      \"message\": \"Profile photo successfully varified\",\n      \"is_valid\": true,\n      \"number_of_faces\": 1,\n      \"predicted_age_range\": \"(50-60)\",\n      \"predicted_gender\": \"male\"\n    }\n  }\n```\n\n\n- When `age` is none\n```bash\ncurl -X 'POST' \\\n  'http://127.0.0.1:8000/validate_profile_photo' \\\n  -H 'accept: application/json' \\\n  -H 'Content-Type: multipart/form-data' \\\n  -F 'age=' \\\n  -F 'gender=male' \\\n  -F 'slack=0.25' \\\n  -F 'photo=@photograph.jpg;type=image/jpeg'\n  ```\nResponse Body\n```json\n{\n  \"response\": {\n    \"message\": \"Profile photo successfully varified\",\n    \"is_valid\": true,\n    \"number_of_faces\": 1,\n    \"predicted_gender\": \"male\"\n  }\n}\n```\nSome more examples of responses in different senarios\n\n- When non-human face image is given\n\n```json\n{\n  \"response\": {\n    \"message\": \"No face detected or multiple faces detected.\",\n    \"is_valid\": false\n  }\n}\n```\n- When predicted age does not matches with given age\n```json\n{\n  \"response\": {\n    \"message\": \"Profile photo not verified because the predicted age is outside the acceptable range. You can reconfigure the slack value\",\n    \"is_valid\": false,\n    \"number_of_faces\": 1,\n    \"predicted_age_range\": \"(50-60)\",\n    \"predicted_gender\": \"male\"\n  }\n}\n```\n\n- When predicted gender does not matches with given gender\n``` json\n{\n  \"response\": {\n    \"message\": \"Profile photo not verified because the predicted gender does not match the given gender value\",\n    \"is_valid\": false,\n    \"number_of_faces\": 1,\n    \"predicted_age_range\": \"(50-60)\",\n    \"predicted_gender\": \"male\"\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyounis-ali%2Fphoto-validation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyounis-ali%2Fphoto-validation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyounis-ali%2Fphoto-validation/lists"}