Skip to content

Junction-Hackathon/junction-ai

Repository files navigation

Qurbani - AI-Powered Sacrifice Video Validation Platform (ai)

Hackathon Project for Junction 2025
Developed for Al-Insan Al-Jazairi Association to manage Qurbani (sacrifice) donations from Algerian donors to African communities.

๐ŸŽฏ Project Overview

Qurbani is an innovative AI-powered platform that automates the validation and management of sacrifice videos for charitable organizations. The platform ensures transparency and trust between donors and recipients by providing automated verification of sacrifice rituals through advanced computer vision and natural language processing.

๐ŸŒŸ Key Features

  • ๐Ÿ” Sacrifice Detection: AI-powered detection of animals, people, and ritual elements in videos
  • ๐ŸŽค Donor Mention Verification: Voice recognition to confirm donor name mentions during the ritual
  • ๐Ÿฉธ Blood Blurring: Automatic blood detection and blurring for sensitive viewers
  • ๐Ÿค– Multilingual Chatbot: AI assistant supporting Arabic, French, and English for donor inquiries
  • โ˜๏ธ Cloud Integration: Seamless video processing and storage with Cloudinary
  • โšก Real-time Processing: Kafka-based message queuing for scalable video processing

๐Ÿ—๏ธ Architecture

The platform consists of several AI-powered microservices:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   FastAPI API   โ”‚โ”€โ”€โ”€โ”€โ”‚   Kafka Queue   โ”‚โ”€โ”€โ”€โ”€โ”‚ AI Video Pipelineโ”‚
โ”‚                 โ”‚    โ”‚                 โ”‚    โ”‚                 โ”‚
โ”‚ โ€ข REST Endpointsโ”‚    โ”‚ โ€ข Message Queue โ”‚    โ”‚ โ€ข YOLO Detectionโ”‚
โ”‚ โ€ข Chatbot       โ”‚    โ”‚ โ€ข Task Manager  โ”‚    โ”‚ โ€ข Whisper STT   โ”‚
โ”‚ โ€ข File Upload   โ”‚    โ”‚ โ€ข Async Proc.   โ”‚    โ”‚ โ€ข Blood Blurringโ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚                        โ”‚                        โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                  โ”‚
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚   Cloudinary    โ”‚
                         โ”‚  Video Storage  โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

View our diagrams View our technical file

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.8+
  • FFmpeg installed on system
  • Kafka server running
  • Cloudinary account
  • Google AI API key

Installation

  1. Clone the repository
git clone <repository-url>
cd qurbani
  1. Install dependencies
pip install -r requirements.txt
  1. Set up environment variables
# Edit .env with your configuration

Required environment variables:
```env
# Kafka Configuration
KAFKA_SERVERS=localhost:9092

# Cloudinary Configuration
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret

# Google AI (for chatbot)
GOOGLE_API_KEY=your_google_ai_api_key
  1. Initialize the chatbot knowledge base
cd chatbot-assistant/scripts
python data_embadding.py
  1. Start the application
uvicorn app.main:app --reload

The API will be available at http://localhost:8000

๐Ÿ“ก API Endpoints

Health Check

GET /

Returns server status.

Video Processing

POST /process-video
Content-Type: application/json

{
  "donor_id": "12345",
  "first_name": "Ahmed",
  "last_name": "Benali",
  "video_link": "https://res.cloudinary.com/..."
}

Response:

{
  "is_audhia": true,
  "donor_mentioned": true,
  "match_score": 0.95,
  "transcript": "Bismillah, this sacrifice is for Ahmed Benali...",
  "blurred_video_url": "https://res.cloudinary.com/.../blurred_video.mp4"
}

Chatbot Assistant

POST /ask
Content-Type: application/json

{
  "question": "ูƒูŠู ูŠู…ูƒู†ู†ูŠ ุงู„ุชุฃูƒุฏ ู…ู† ุตุญุฉ ุงู„ุฐุจูŠุญุฉุŸ"
}

Response:

{
  "answer": "ูŠุชู… ุงู„ุชุญู‚ู‚ ู…ู† ุตุญุฉ ุงู„ุฐุจูŠุญุฉ ู…ู† ุฎู„ุงู„ ุงู„ุฐูƒุงุก ุงู„ุงุตุทู†ุงุนูŠ ุงู„ุฐูŠ ูŠุญู„ู„ ุงู„ููŠุฏูŠูˆ..."
}

๐Ÿค– AI Pipeline Components

1. Sacrifice Detection (object_detector/)

  • Technology: YOLO v8
  • Purpose: Detects people, sheep, and knives in video frames
  • Output: Boolean indicating valid sacrifice scene

2. Donor Mention Detection (mention-detector/)

  • Technology: Faster Whisper
  • Purpose: Transcribes audio and matches donor names
  • Features: Fuzzy matching with confidence scores

3. Blood Blurring (blood-detector/)

  • Technology: OpenCV color detection
  • Purpose: Automatically blurs blood in videos
  • Method: HSV color space filtering and Gaussian blur

4. Multilingual Chatbot (chatbot-assistant/)

  • Technology: Sentence Transformers + Google Gemini
  • Languages: Arabic, French, English
  • Features: Context-aware responses using FAISS vector search

๐Ÿ› ๏ธ Development

Project Structure

qurbani/
โ”œโ”€โ”€ app/                    # FastAPI application
โ”‚   โ”œโ”€โ”€ main.py            # Application entry point
โ”‚   โ””โ”€โ”€ routes/            # API route handlers
โ”œโ”€โ”€ blood-detector/        # Blood blurring module
โ”œโ”€โ”€ chatbot-assistant/     # AI chatbot system
โ”œโ”€โ”€ mention-detector/      # Voice recognition module
โ”œโ”€โ”€ object_detector/       # YOLO-based detection
โ””โ”€โ”€ requirements.txt       # Python dependencies

Adding New Features

  1. Extend AI Pipeline: Add new detection modules in respective directories
  2. API Routes: Create new endpoints in app/routes/
  3. Chatbot Knowledge: Update chatbot-assistant/dataset/context.json
  4. Message Queue: Add new Kafka topics for additional processing

Running Tests

# Run API tests
pytest tests/

# Test individual AI components
python object_detector/scripts/video_checker.py
python mention-detector/scritps/mention.py

๐ŸŒ Multilingual Support

The platform supports three languages:

  • Arabic (ุงู„ุนุฑุจูŠุฉ): Primary language for North African donors
  • French (Franรงais): Common language in West African regions
  • English: International communication

Language detection is automatic based on input text patterns and keywords.

๐Ÿ“‹ Use Case Scenarios

1. Donor Verification Flow

  1. sacrificer uploads sacrifice video via mobile app
  2. pushed to kackend via kafka
  3. backend upload it on cloudinary
  4. AI pipeline processes video for authenticity
  5. System verifies donor name mention in audio
  6. Blood is automatically blurred for sensitive viewers

2. Charity Management

  1. Organization receives verified videos
  2. Dashboard shows processing status
  3. Failed verifications flagged for manual review
  4. Statistics and reports generated for transparency

3. Donor Support

  1. Donors ask questions via chatbot
  2. Multilingual AI provides instant answers
  3. Complex queries escalated to human support
  4. Knowledge base continuously updated

๐Ÿ”ง Configuration

Kafka Topics

  • video.process.start: Triggers video processing pipeline
  • video.process.complete: Notifies completion of processing

AI Model Configuration

  • YOLO: Pre-trained YOLOv8x for object detection
  • Whisper: Base model for speech recognition
  • Sentence Transformers: Multilingual MiniLM for embeddings
  • Gemini: Google's LLM for conversational responses

Cloud Deployment

The platform is designed for cloud deployment with:

  • API: Can be deployed on any container platform (AWS ECS, Google Cloud Run)
  • Kafka: Use managed services (AWS MSK, Confluent Cloud)
  • Storage: Cloudinary for video storage and CDN

๐Ÿ“Š Performance Metrics

  • Video Processing: ~30-60 seconds per 2-minute video
  • Sacrifice Detection: 95%+ accuracy on test dataset
  • Voice Recognition: 90%+ accuracy for clear audio
  • Chatbot Response: <2 seconds average response time

Hackathon Team

Junction 2025 Submission

  • Team: --force
  • Track: Social Impact / AI Track
  • Partner: Al-Insan Al-Jazairi Association

Acknowledgments

  • Al-Insan Al-Jazairi Association for these efforts
  • Junction Hackathon organizers

Built with โค๏ธ during Junction 2025 Hackathon to serve the Muslim community and promote transparency in charitable giving.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors