How abdelfadelachraf/ai-image-detector works
AI Image Detector is a React interface backed by a FastAPI image-classification service using a trained EfficientNetB0 model. The main workflow is: a user selects an image, client-side validation and state manage submission, the API validates and preprocesses the upload, and the predictor returns a REAL/FAKE verdict and confidence, with an optional Grad-CAM heatmap displayed in the analysis view. The repository also documents dataset preparation, model training and evaluation in a notebook. Edges reflect excerpts, the source index, or README statements; unsampled implementation details are not inferred.
Main entry points: Hero.jsx Upload workflow · predict.py Prediction endpoint · predictor.py Classification and heatmap · main.py FastAPI application
Components 24
Web interface
- Page composition
frontend/src/App.jsx - Upload workflow
frontend/src/components/Hero.jsx - Image selection
frontend/src/components/Dropzone.jsx - Detection state
frontend/src/hooks/useDetector.js - File validation
frontend/src/utils/validation.js - HTTP client
frontend/src/api/detector.js - Scan animation
frontend/src/components/Scanner.jsx - Verdict panel
frontend/src/components/ResultPanel.jsx - Verdict scale
frontend/src/components/VerdictAxis.jsx - Detailed analysis
frontend/src/components/Analysis.jsx - Heatmap view
frontend/src/components/ModelView.jsx - How it works
frontend/src/components/HowItWorks.jsx - Known limitations
frontend/src/components/Limitations.jsx
API service
- FastAPI application
backend/app/main.py - Service configuration
backend/app/config.py - Health endpoint
backend/app/routers/health.py - Prediction endpoint
backend/app/routers/predict.py - Predictor dependency
backend/app/dependencies.py - Response schemas
backend/app/schemas.py
Inference pipeline
- Image preprocessing
backend/app/services/preprocessing.py - Classification and heatmap
backend/app/services/predictor.py
Model lifecycle
- Trained model
backend/model/detector.keras - Data and model training
notebooks/data processing and training the model .ipynb
Other components
- Image user
Connections 30
- Image user → Upload workflow: selects image
README.md - Page composition → Upload workflow: renders
frontend/src/App.jsx - Page composition → How it works: renders
frontend/src/App.jsx - Page composition → Known limitations: renders
frontend/src/App.jsx - Upload workflow → Image selection: renders
frontend/src/components/Hero.jsx - Upload workflow → Detection state: uses state
frontend/src/components/Hero.jsx - Upload workflow → Scan animation: renders
frontend/src/components/Hero.jsx - Upload workflow → Verdict panel: renders
frontend/src/components/Hero.jsx - Upload workflow → Detailed analysis: renders
frontend/src/components/Hero.jsx - Detection state → File validation: validates file
frontend/src/hooks/useDetector.js - Detection state → HTTP client: requests prediction
frontend/src/hooks/useDetector.js - HTTP client → Prediction endpoint: posts image
README.md - HTTP client → Health endpoint: checks status
README.md - Verdict panel → Verdict scale: renders
frontend/src/components/ResultPanel.jsx - Detailed analysis → Heatmap view: renders heatmap
frontend/src/components/Analysis.jsx - FastAPI application → Health endpoint: registers route
backend/app/main.py - FastAPI application → Prediction endpoint: registers route
backend/app/main.py - FastAPI application → Service configuration: reads settings
backend/app/main.py - FastAPI application → Classification and heatmap: loads at startup
backend/app/main.py - Classification and heatmap → Trained model: loads model
README.md - Prediction endpoint → Service configuration: checks upload limits
backend/app/routers/predict.py - Prediction endpoint → Predictor dependency: gets predictor
backend/app/routers/predict.py - Prediction endpoint → Image preprocessing: preprocesses upload
backend/app/routers/predict.py - Prediction endpoint → Classification and heatmap: requests prediction
backend/app/routers/predict.py - Prediction endpoint → Response schemas: declares response
backend/app/routers/predict.py - Predictor dependency → Classification and heatmap: provides instance
backend/app/dependencies.py - Health endpoint → Response schemas: uses response schema
backend/app/routers/health.py - Image preprocessing → Service configuration: reads image sizes
backend/app/services/preprocessing.py - Classification and heatmap → Response schemas: builds response
backend/app/services/predictor.py - Data and model training → Trained model: produces trained artifact
README.md