rag-data-platform / README.md
Vipooshanb's picture
Deploy Mozhii RAG Data Platform
af25178 verified
|
Raw
History Blame Contribute Delete
7.84 kB
---
title: Mozhii RAG Data Platform
emoji: πŸ—οΈ
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
---
# πŸ—οΈ Mozhii RAG Data Platform v0.1
## Creating Universal Tamil AI Ecosystem
A web-based data platform for RAG (Retrieval-Augmented Generation) dataset creation, specifically designed for Tamil language content with enterprise-grade workflow management.
---
## πŸ“ Project Structure
```
mozhii-platform/
β”œβ”€β”€ app/
β”‚ β”œβ”€β”€ __init__.py # Flask app initialization
β”‚ β”œβ”€β”€ config.py # Configuration settings
β”‚ β”œβ”€β”€ routes/
β”‚ β”‚ β”œβ”€β”€ __init__.py # Routes initialization
β”‚ β”‚ β”œβ”€β”€ raw_data.py # Raw data tab API endpoints
β”‚ β”‚ β”œβ”€β”€ cleaning.py # Cleaning tab API endpoints
β”‚ β”‚ β”œβ”€β”€ chunking.py # Chunking tab API endpoints
β”‚ β”‚ └── admin.py # Admin approval endpoints
β”‚ β”œβ”€β”€ services/
β”‚ β”‚ β”œβ”€β”€ __init__.py # Services initialization
β”‚ β”‚ β”œβ”€β”€ huggingface.py # HuggingFace API integration
β”‚ β”‚ └── storage.py # Local storage management
β”‚ └── models/
β”‚ β”œβ”€β”€ __init__.py # Models initialization
β”‚ └── schemas.py # Data schemas/models
β”œβ”€β”€ static/
β”‚ β”œβ”€β”€ css/
β”‚ β”‚ └── styles.css # Modern UI styles
β”‚ β”œβ”€β”€ js/
β”‚ β”‚ β”œβ”€β”€ main.js # Main JavaScript
β”‚ β”‚ β”œβ”€β”€ raw-data.js # Raw data tab logic
β”‚ β”‚ β”œβ”€β”€ cleaning.js # Cleaning tab logic
β”‚ β”‚ └── chunking.js # Chunking tab logic
β”‚ └── assets/
β”‚ └── logo.svg # Platform logo
β”œβ”€β”€ templates/
β”‚ └── index.html # Main HTML template
β”œβ”€β”€ data/
β”‚ β”œβ”€β”€ pending/ # Files awaiting approval
β”‚ β”‚ β”œβ”€β”€ raw/ # Pending raw files
β”‚ β”‚ β”œβ”€β”€ cleaned/ # Pending cleaned files
β”‚ β”‚ └── chunked/ # Pending chunks
β”‚ └── approved/ # Approved files (synced with HF)
β”‚ β”œβ”€β”€ raw/
β”‚ β”œβ”€β”€ cleaned/
β”‚ └── chunked/
β”œβ”€β”€ requirements.txt # Python dependencies
β”œβ”€β”€ run.py # Application entry point
└── README.md # This file
```
---
## πŸ”„ Data Flow Architecture
```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ RAW DATA TAB β”‚ β†’ Collector submits Tamil content
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Admin Review β”‚ β†’ Approve/Reject
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ HF: mozhii-raw β”‚ β†’ HuggingFace Repository #1
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ CLEANING TAB β”‚ β†’ NLP team cleans content
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Admin Review β”‚ β†’ Approve/Reject
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ HF: mozhii-cleanβ”‚ β†’ HuggingFace Repository #2
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ CHUNKING TAB β”‚ β†’ QA team creates chunks
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Admin Review β”‚ β†’ Approve/Reject
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ HF: mozhii-chunkβ”‚ β†’ HuggingFace Repository #3 (RAG-READY)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Embedding Pipelineβ”‚ β†’ External (FAISS/Chroma)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```
---
## πŸš€ Quick Start
### 1. Install Dependencies
```bash
cd mozhii-platform
pip install -r requirements.txt
```
### 2. Configure HuggingFace
Create a `.env` file:
```
HF_TOKEN=your_huggingface_token
HF_RAW_REPO=your-org/mozhii-raw-data
HF_CLEANED_REPO=your-org/mozhii-cleaned-data
HF_CHUNKED_REPO=your-org/mozhii-chunked-data
```
### 3. Run the Application
```bash
python run.py
```
### 4. Open in Browser
Navigate to `http://localhost:5000`
---
## πŸ” Features
- βœ… **Evidence at every stage** - Complete audit trail
- βœ… **Team parallelism** - Multiple users can work simultaneously
- βœ… **Admin approval workflow** - Quality control gate with editing
- βœ… **Edit before approval** - Fix mistakes without rejecting submissions
- βœ… **HuggingFace integration** - Direct push to your HF repositories
- βœ… **Custom HF repos** - Use your own HuggingFace account
- βœ… **Role-based access** - Collector, Cleaner, Chunker, Admin
- βœ… **Tamil language optimized** - RTL support, Tamil fonts
---
## βš™οΈ Admin Panel Features
### Edit Functionality
The admin panel now includes powerful editing capabilities:
- **✏️ Edit Button**: Click the edit icon next to any pending item to modify its content
- **Live Preview**: See changes in real-time before saving
- **Character Count**: Track content length while editing
- **Save & Continue**: Save edits without approving
- **Reject with Reason**: Provide feedback when rejecting submissions
### HuggingFace Integration
Push approved data directly to your HuggingFace repositories:
1. **Configure Credentials**: Enter your HF token in the admin panel
2. **Set Repository**: Specify your target repository (e.g., `username/mozhii-data`)
3. **One-Click Push**: Upload all approved data with a single click
4. **Detailed Results**: See upload status for raw, cleaned, and chunked data
**Setup Instructions:**
```bash
# 1. Get your HuggingFace token
# Visit: https://huggingface.co/settings/tokens
# 2. Create dataset repositories
# Visit: https://huggingface.co/new-dataset
# Create: username/mozhii-raw-data
# Create: username/mozhii-cleaned-data
# Create: username/mozhii-chunked-data
# 3. Enter credentials in Admin Panel or .env file
HF_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
HF_RAW_REPO=your-username/mozhii-raw-data
```
### Workflow
```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ User Submits Data β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Admin Reviews β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓
β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”
↓ ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Edit β”‚ β”‚ Approve β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜
↓ ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Save β”‚ β”‚Push to β”‚
β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜ β”‚ HF β”‚
↓ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Approve β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```
---
## πŸ‘₯ Roles
| Role | Access |
|------|--------|
| Collector | RAW DATA tab only |
| Cleaner | CLEANING tab only |
| Chunker | CHUNKING tab only |
| Admin | All tabs + Approval queue |
---
## πŸ“ License
MIT License - Mozhii AI Team 2026