{"id":25619310,"url":"https://github.com/mhdned/smiledetection","last_synced_at":"2025-04-14T00:40:53.437Z","repository":{"id":243748925,"uuid":"813176325","full_name":"mhdned/SmileDetection","owner":"mhdned","description":"Smile Detection is a FastAPI-based web application that allows users to upload images for processing using AI models. The application supports file uploads, processes images, and returns results to the client.","archived":false,"fork":false,"pushed_at":"2025-03-12T16:39:38.000Z","size":4548,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T14:52:30.640Z","etag":null,"topics":["fastapi","jija2","python3"],"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/mhdned.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-06-10T16:00:30.000Z","updated_at":"2025-03-25T18:22:27.000Z","dependencies_parsed_at":"2024-06-11T01:25:05.601Z","dependency_job_id":null,"html_url":"https://github.com/mhdned/SmileDetection","commit_stats":null,"previous_names":["mhdned/hay","mhdned/smiledetection"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhdned%2FSmileDetection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhdned%2FSmileDetection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhdned%2FSmileDetection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhdned%2FSmileDetection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhdned","download_url":"https://codeload.github.com/mhdned/SmileDetection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248804456,"owners_count":21164125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","jija2","python3"],"created_at":"2025-02-22T06:16:50.802Z","updated_at":"2025-04-14T00:40:53.425Z","avatar_url":"https://github.com/mhdned.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smile Detection\n\n\u003e FastAPI-based Image Processing Application\n\n## Overview\n\n**Smile Detection** is a FastAPI-based web application that allows users to upload images for processing using AI models. The application supports file uploads, processes images, and returns results to the client.\n\n## Features\n\n- Upload PNG and JPG images for processing\n- AI-based image analysis using a pre-trained model\n- Serve processed files for download\n- Simple HTML-based frontend using Jinja2 templates\n- Static file handling via FastAPI\n\n## Installation\n\n### Prerequisites\n\n- Python 3.8+\n- FastAPI\n- Uvicorn (for running the server)\n- OpenCV (cv2) for image processing\n- NumPy for numerical computations\n- Joblib for loading the AI model\n\n### Setup Instructions\n\n1. Clone the repository:\n   ```sh\n   git clone https://github.com/mhdned/SmileDetection.git\n   cd SmileDetection\n   ```\n2. Create a virtual environment:\n   ```sh\n   python -m venv venv\n   source venv/bin/activate  # On Windows use `venv\\Scripts\\activate`\n   ```\n3. Install dependencies:\n   ```sh\n   pip install -r requirements.txt\n   ```\n4. Run the application:\n   ```sh\n   uvicorn main:app --reload\n   ```\n\n## API Endpoints\n\n### Check API Status\n\n**Endpoint:** `GET /`\n\n- Returns an HTML page confirming that the API is live.\n\n### Upload and Process Image\n\n**Endpoint:** `POST /process`\n\n- Accepts an image file (PNG, JPG) and processes it using the AI model.\n- Returns an HTML response with the processed result.\n\n### Download Processed File\n\n**Endpoint:** `GET /file/{file_name}`\n\n- Allows users to download processed files.\n\n## AI Model\n\nThe application utilizes an AI model stored in `smile.z`, which is loaded using Joblib. The model is used to analyze images and classify them accordingly. The AI logic is implemented in `core/ai.py`:\n\n```python\nimport cv2\nfrom joblib import load\nimport numpy as np\n\nclf = load(\"smile.z\")\n\ndef load_pic(item):\n    img = cv2.imread(item)\n    img_r = cv2.resize(img,(32,32))\n    img_r = img_r / 255\n    img_r = img_r.flatten()\n    img_r = np.array([img_r])\n\n    label = clf.predict(img_r)[0]\n    return label\n```\n\n## Project Structure\n\n```\n├── main.py            # Main application file\n├── core/\n│   ├── ai.py          # AI model integration\n│   ├── jinja.py       # Jinja template engine configuration\n├── static/            # Static files (CSS, JS, images)\n├── templates/         # HTML templates\n├── uploads/           # Uploaded images\n├── requirements.txt   # Python dependencies\n├── README.md          # Project documentation\n```\n\n## Technologies Used\n\n\u003cp align=\"left\"\u003e\n  \u003ca href=\"https://skillicons.dev\"\u003e\n    \u003cimg src=\"https://skillicons.dev/icons?i=python,fastapi\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## License\n\nThis project is licensed under the MIT License. See `LICENSE` for details.\n\n## Author\n\nDeveloped by [Mehtiuo](https://github.com/mhdned) \u0026 [Sudotome](https://github.com/sudotome).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhdned%2Fsmiledetection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhdned%2Fsmiledetection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhdned%2Fsmiledetection/lists"}