Spaces:
Sleeping
Download README.md from amadmateen/SentinelReview-AI: direct link, hf CLI and curl.
- Browser
- Download file 6.75 kB
-
https://huggingface.co/spaces/amadmateen/SentinelReview-AI/resolve/main/README.md
- Command line
-
hf download hf://spaces/amadmateen/SentinelReview-AI/README.md
-
curl -L -o README.md https://huggingface.co/spaces/amadmateen/SentinelReview-AI/resolve/main/README.md
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:
- Create a new Space on Hugging Face.
- Choose Docker as the SDK (with a Blank/Custom template).
- Push files to the Hugging Face space repository.
- 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.