SentinelReview-AI / README.md
amadmateen's picture
Docs: Add Hugging Face Space Docker configuration frontmatter to README.md
6e55aeb
|
Raw History Blame Contribute Delete
6.75 kB
metadata
title: SentinelReview AI
emoji: πŸ›‘οΈ
colorFrom: blue
colorTo: gray
sdk: docker
app_file: app.py
pinned: false

SentinelReview AI: Multimodal Review Authenticity & Fraud Audit Platform

An enterprise-grade, containerized machine learning application designed to evaluate, verify, and catalog online review authenticity. By auditing textual semantics (DistilBERT), user sentiment metadata (NLTK VADER), and visual contexts (ResNet skeletal projection), SentinelReview AI mitigates review manipulation, helping e-commerce platforms and trust operations teams protect customer trust.


πŸ’Ό Business Vision & Case Study

The Problem: E-Commerce Trust Degradation

In the digital commerce landscape, reputation is currency. Fake, paid, and bot-generated reviews degrade user trust, skew search algorithm rankings, and cost retailers billions in return overheads. Traditional rule-based fraud detection systems are easily bypassed by advanced generative AI reviews that mimic human style, making automated, multi-vector semantic analysis critical.

Who Uses SentinelReview AI?

  • E-Commerce Marketplaces: Automated pre-publication filtering of merchant/product reviews.
  • Trust & Safety Operations Teams: Live-monitoring dashboards to isolate coordinated review manipulation campaigns.
  • Third-Party Review Aggregators: Auditing platforms (e.g. travel booking sites) requiring independent trust scores for verification.

Why Multimodal & Multi-Vector AI?

Review manipulators can optimize text to sound perfectly natural, but they fail to balance metadata characteristics:

  • Text Semantics: DistilBERT evaluates language features, structural flows, and contextual consistency.
  • Metadata Profiling: NLTK VADER sentiment compound scores, capitalization ratios, and punctuation density check if the emotional tone matches the review length and style.
  • Visual Verification: Product context images uploaded by customers are tracked alongside the review vectors, presenting audit reviewers with a combined evaluation layout.

πŸ—οΈ Platform Architecture

SentinelReview AI utilizes a three-tier decoupled architecture designed for high throughput, thread-safe model evaluation, and low-latency startup cycles.

graph TD
    User([Security Auditor Client]) -->|1. Submit Review & Context Image| Server[Flask API Server]
    Server -->|2. Query Cache Singletons| Cache[(Memory Resource Cache)]
    Cache -->|3. Get model & preprocessors| Inference[Inference Pipeline]
    Inference -->|4. Text Tokenization| DBert[DistilBERT Encoder]
    Inference -->|5. Metadata Normalization| VADER[VADER Polarity Vector]
    Inference -->|6. Concatenate Features| Classifier[Joint FFN Classifier]
    Classifier -->|7. Verified / Suspicious log| Response[Audit Report Compiler]
    Response -->|8. Request LLM explanation| Nemo[Mistral Nemo API]
    Response -->|9. Serve JSON report| User

πŸ“ Project Layout

Fake_Review_Detection/
β”œβ”€β”€ models/
β”‚   └── DistilBert_resnet.pth        # Pre-trained multimodal weights (310MB - Git LFS)
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ __init__.py                  # Package initializer
β”‚   β”œβ”€β”€ config.py                    # Hardware mapping (CUDA/MPS/CPU) and path configurations
β”‚   β”œβ”€β”€ model.py                     # ExactDistilBertResNetModel PyTorch architecture
β”‚   β”œβ”€β”€ preprocessing.py             # Feature engineering (VADER sentiment & capitalization ratios)
β”‚   └── inference.py                 # Thread-safe Singletons and LLM explanation clients
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   └── style.css                # "AI Audit Dashboard" styling (dark theme, scan animation)
β”‚   └── js/
β”‚       └── script.js                # Async fetch controls, copy-to-clipboard, drag uploader
β”œβ”€β”€ templates/
β”‚   └── index.html                   # Semantic HTML dashboard template
β”œβ”€β”€ app.py                           # High-concurrency Flask application server
β”œβ”€β”€ main.py                          # Local CLI test utility
β”œβ”€β”€ Dockerfile                       # Multi-stage production container manifest
β”œβ”€β”€ requirements.txt                 # Locked package dependencies
β”œβ”€β”€ LICENSE                          # MIT License
β”œβ”€β”€ CHANGELOG.md                     # Update history log
β”œβ”€β”€ CONTRIBUTING.md                  # Development guidelines
└── .gitignore                       # File ignoring guidelines

βš™οΈ Setup & Local Execution

1. Requirements

Ensure you have Python 3.11 (or compatible release) installed. Create a clean virtual environment:

python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

2. Install Packages

pip install -r requirements.txt

3. Place Pre-Trained Weights

Ensure the weights file DistilBert_resnet.pth is placed under the ./models directory before launching the app.

4. CLI Execution Utility

To test the inference pipeline directly from your shell:

python main.py

This utility will prompt you to enter raw review text and outputs a complete terminal audit report.

5. Start Flask Server Locally

python app.py

Open http://localhost:7860 in your web browser.


🐳 Docker Deployment

To compile and launch the application inside a local container matching the Hugging Face production environment:

# Build the container
docker build -t sentinel-review-ai .

# Run the container mapping to port 7860
docker run -p 7860:7860 sentinel-review-ai

Navigate to http://localhost:7860.


πŸš€ Hugging Face Spaces Deployment

This repository is configured for deployment on Hugging Face Spaces using the Docker SDK:

  1. Create a new Space on Hugging Face.
  2. Choose Docker as the SDK (with a Blank/Custom template).
  3. Push files to the Hugging Face space repository.
  4. The space will automatically build the container and deploy the app.

⚠️ Model Limitations & Future Work

  • Dead ResNet Weights Constraint: The current pre-trained model was compiled with a zero-filled placeholder for ResNet Conv features during training. Active image processing is bypassed during prediction to preserve identical classification outputs. Future iterations will include full retraining of the ResNet branch using paired image-text datasets.
  • Static Metadata Scaling: Extracted metadata vectors (e.g. character length ratios) are unnormalized. Introducing z-score scaling relative to catalog averages will improve classifier stability.