How slainteee/jatayu-contentmoderation works
Main Components
• API Server & Core Engine – This is encapsulated by the “app.py” file that launches the Flask API. It acts as the gateway for incoming moderation requests.
• Content Moderation Modules – These represent the various specialized pipelines/algorithms:
– Text moderation (e.g., hate speech, phishing detection in text)
– Image moderation (using OCR with Tesseract for extracting text and models for violence detection)
– Audio/Video moderation (using speech-to-text features with libraries like Sphinx or Google Speech Recognition)
– Spam Classification – found in the “Spam Classifier” directory (with its own notebook and saved models).
– Violence Detection – provided via both PyTorch and TensorFlow implementations in the “Violence-Detection” directory.
– Phishing Detection – found in the “PhishingWebsite” section, with feature extraction scripts, dataset, and trained model files.
– Hate/Content Analysis – the “hatespeech” directory supports additional content moderation modalities.
• Frontend/Client Interfaces – There are two:
– Mobile demonstration (Android app under “App/app”)
– Web demo via Flask (in the “Web-Frontend” directory, which includes “server.py”, static assets, templates, etc.)
• Data & Model Artifacts – Look at dataset directories, saved models (e.g., “model_logistic_regression.pkl”, “NB_model.pkl”), and supporting files used to train and operationalize ML models.
Relationships and Interactions
• Client Interaction Layer: Mobile apps (Android) and web browser frontends send requests (including media or text content) to the API server.
• API Gateway: The central “app.py” Flask script listens for incoming requests, then routes them to the appropriate AI/ML module based on the content type.
• Processing Pipelines: Once a request is received:
– Text data might be sent for NLP processing using NLTK/spaCy.
– Images pass through an OCR engine (Tesseract) and possibly a violence detection model.
– Audio/video content undergoes speech recognition and subsequent analysis.
– Dedicated modules for phishing detection, spam classification, and hate speech analysis get invoked as needed.
• Data Flow & Model Inference: The API calls extract features and uses pre-trained models (loaded from the “trainedmodel”, “saved_models”, or similar directories) to decide the level of moderation required.
• Storage/Static Assets: Files related to static images, CSS for the interface, and model outputs may be stored in defined folders.
Architectural Patterns and Design Principles
• Modular Design: Each content moderation function is separated into its own component (or service module) so that the API can delegate processing.
• Separation of Concerns: The Android app and web frontend are distinct from the backend API service, and ML pipelines are isolated from the API layer.
• Extensibility: The structure (with separate directories for each type of analysis) indicates that new moderation modules could be added with clear interfaces.
• Standard Communication: RESTful calls (or similar API calls) connect the UI to backend processing.
Relevant Technologies
• Python with Flask for the API.
• ML/DL Frameworks: TensorFlow, PyTorch, and Scikit-Learn for different moderation models.
• Natural Language Processing: NLTK and spaCy.
• OCR: Tesseract via pytesseract.
• Speech Recognition: Sphinx/Google Speech Recognition libraries for audio.
• Frontend Technologies: Flask templating for the web demo and Android (Java) for the mobile demo, with corresponding Gradle configurations.
• Version Control (Git), CI/CD (GitHub workflows), and requirements management (requirements.txt, gradle build files).