Spaces:
Runtime error
Runtime error
File size: 3,928 Bytes
eb8da86 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
---
title: FaceAging AI
emoji: π΄
colorFrom: gray
colorTo: indigo
sdk: docker
sdk_version: 5.30.0
app_file: app.py
pinned: false
---
# FaceAging AI β Realistic Face Aging and De-Aging with AI
**FaceAging AI** is an advanced AI-powered web application that transforms face images to appear older or younger with realistic results. It leverages deep learning models for face detection and age transformation, offering an intuitive interface for users to upload images and see instant aged or de-aged outputs.
---
## Features
* **Face Aging & De-Aging**: Convert young faces to old and vice versa with high visual fidelity.
* **Automatic Face Detection**: Detects faces in uploaded images using OpenCV to process only valid faces.
* **Base64 Image Encoding**: Returns transformed images efficiently encoded for seamless frontend display.
* **FastAPI Backend**: Robust and scalable backend API handling image processing and AI inference.
* **Simple, Responsive UI**: User-friendly frontend using HTML, CSS, JavaScript, and Jinja2 templates.
* **CORS Enabled**: Allows cross-origin requests for flexible frontend-backend integration.
---
## Tech Stack
* **Backend**: FastAPI (Python)
* **Frontend**: HTML, CSS, JavaScript, Jinja2 Templates
* **AI & Image Processing**: OpenCV, Pillow, NumPy, Custom Face Aging Models
* **Deployment**: Cloud-ready (Render, Heroku, or any ASGI-compatible platform)
---
## Project Structure
```
faceaging-ai/
βββ main.py # FastAPI app entry point with endpoints
βββ helper.py # AI face aging helper functions & models
βββ static/ # Static files (CSS, JS, images)
βββ templates/ # HTML templates (Jinja2)
βββ requirements.txt # Python dependencies
βββ README.md # Project documentation (this file)
βββ Procfile # For deployment (if using Heroku/Render)
```
---
## Setup and Installation
### Prerequisites
* Python 3.8+
* Virtual environment tool (venv or conda)
* FastAPI, Uvicorn, OpenCV, Pillow, NumPy (see requirements.txt)
### Steps
1. **Clone the repository**
```bash
git clone https://github.com/parthmax2/faceaging-ai.git
cd faceaging-ai
```
2. **Create and activate a virtual environment**
```bash
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
```
3. **Install dependencies**
```bash
pip install -r requirements.txt
```
4. **Run the FastAPI development server**
```bash
uvicorn main:app --reload
```
5. **Access the app**
Open your browser and navigate to:
```
http://127.0.0.1:8000
```
Upload a face image, select the conversion type (Young to Old or Old to Young), and click Generate to see the transformed image.
---
## API Endpoints
* `GET /` β Serves the main web interface.
* `POST /convert/` β Accepts an image file and conversion type, returns the aged or de-aged image as a base64 string.
---
## Deployment
You can deploy this FastAPI app on any ASGI-compatible platform:
* **Render:** Easy cloud deployment with automatic Dockerfile or Python environment detection.
* **Heroku:** Use the provided `Procfile` and `requirements.txt`.
* **Other platforms:** Ensure support for Python 3.8+, ASGI, and WebSocket if needed.
---
## Contribution
Contributions are welcome! Please open issues or submit pull requests for:
* Improving model accuracy
* Enhancing UI/UX
* Adding new features or endpoints
* Optimizing performance
---
## License
MIT License β free to use, modify, and distribute.
---
## Contact
**Saksham Pathak**
Masterβs in Artificial Intelligence & Machine Learning, IIIT Lucknow
[GitHub](https://github.com/parthmax2) | [LinkedIn](https://linkedin.com/in/sakshampathak) | [Instagram](https://instagram.com/parthmax_)
---
*FaceAging AI Β© Saksham Pathak. Powered by open-source AI and computer vision technologies.* |