ehsanulhaque92/AuraScanAI
0
1---2title: AuraScanAI API3emoji: ๐4colorFrom: blue5colorTo: purple6sdk: docker7app_port: 50008---9 10# AuraScanAI - Vehicle Damage Assessment API11 12This repository contains the complete backend service for the AuraScanAI project, a sophisticated AI-powered system for analyzing vehicle damage from images. The API is built with Flask and serves a custom-trained, multi-task Vision Transformer (ViT) model capable of identifying damage areas and assessing their severity.13 14The live API is deployed as a Docker container on Hugging Face Spaces.15 16---17 18## ๐ Key Features19 20* **AI-Powered Analysis:** Leverages a state-of-the-art Vision Transformer (ViT) model fine-tuned on over 15,000 images of vehicle damage.21* **Multi-Task Learning:** The model simultaneously predicts:22 1. The location of the primary damage area (bounding box).23 2. The overall severity of the damage (`minor`, `moderate`, `severe`).24* **Business Logic Engine:** Includes a post-processing layer to translate AI outputs into actionable business insights, including a realistic estimated repair cost range.25* **Scalable Architecture:** Built with a professional, singleton pattern to ensure the large AI model is loaded only once, providing fast and efficient inference.26* **Containerized & Deployable:** Fully containerized with Docker and configured for seamless deployment on cloud platforms like Hugging Face Spaces.27 28---29 30## ๐ ๏ธ Technology Stack31 32* **AI Framework:** PyTorch33* **Vision Model Library:** `timm` (PyTorch Image Models)34* **API Framework:** Flask35* **WSGI Server:** Gunicorn36* **Containerization:** Docker37* **Cloud Deployment:** Hugging Face Spaces38 39---40 41## โ๏ธ API Endpoints42 43The server provides two main endpoints:44 45### 1. Health Check46 47A simple endpoint to verify that the server is running and responsive.48 49* **Endpoint:** `/ping`50* **Method:** `GET`51* **Success Response (200):**52 ```json53 {54 "message": "Server is alive!",55 "status": "ok"56 }57 ```58 59### 2. Damage Analysis60 61The core endpoint for analyzing an image.62 63* **Endpoint:** `/analyze`64* **Method:** `POST`65* **Request Body:** `multipart/form-data` with a single field:66 * `file`: The vehicle image file (`.jpg`, `.png`, etc.).67* **Success Response (200):** A detailed JSON object containing the full analysis.68 ```json69 {70 "success": true,71 "totalDamages": 1,72 "overallSeverity": "severe",73 "confidence": "0.66",74 "costRange": {75 "min": 800,76 "max": 250077 },78 "damages": [79 {80 "id": "dmg-1",81 "type": "Primary Damage Area",82 "location": "Detected by AI",83 "severity": "severe",84 "estimatedCost": { "min": 800, "max": 2500 },85 "coordinates": [86 [ 423.06, 364.49, 1229.91, 859.14 ]87 ]88 }89 ]90 }91 ```92* **Error Response (4xx/5xx):**93 ```json94 {95 "success": false,96 "error": "Descriptive error message."97 }98 ```99 100---101 102## ๐ MVP Approach & Future Roadmap103 104This project serves as a powerful Proof of Concept (MVP), demonstrating a complete end-to-end pipeline for AI-powered vehicle damage assessment.105 106**Current Capability (MVP):**107The current AI model is an **Image Assessment Model**, designed to identify the single most prominent damage area in an image. It provides a holistic analysis, including an overall severity classification, estimated repair cost, and a bounding box for the primary damage region. This successfully proves the core technology is viable.108 109**Future Roadmap:**110The next phase of this project will involve evolving the AI core into a full **Multi-Object Detector** (e.g., using a DETR or YOLO architecture). This will enable the system to:111- Identify and draw bounding boxes for multiple, distinct damages in a single image.112- Provide a detailed breakdown and cost estimate for each individual damage in the Damage Ledger.