# Smart Egypt AI Translation
**An Integrated Artificial Intelligence Framework for Real-Time Speech-to-Speech Translation.**
This repository contains the backend AI Translation Engine built for the **Smart Egypt Explorer** mobile application. The architecture deploys a highly optimized, multimodal pipeline capable of executing real-time voice translation across multiple languages natively into the colloquial Egyptian Arabic dialect (`arz`).
## Core Architecture
The system utilizes Meta's **SeamlessM4T-v2-Large** model, fundamentally modified to handle real-world acoustic environments and local dialects.
* **Dialect Specialist (QLoRA):** A custom Quantized Low-Rank Adapter fine-tuned on the MGB-3 corpus to map formal Arabic to Egyptian colloquialisms.
* **Acoustic Denoising:** Real-time non-stationary spectral gating via `noisereduce` to suppress ambient street noise prior to matrix attention scoring.
* **Semantic Memory (FAISS RAG):** An active Retrieval-Augmented Generation memory layer utilizing `all-MiniLM-L6-v2` embeddings. It intercepts ASR drift by applying deterministic zero-shot corrections with a strict L2 distance threshold (`< 0.15`).
* **Zero-Disk Deployment:** Hardware I/O operations are bypassed entirely. All multi-part audio payloads execute inside volatile RAM buffers (`io.BytesIO`) using `bfloat16` precision on NVIDIA L4 instances.
## Setup & Installation
**1. Clone the repository:**
```bash
git clone
github.com
cd smart-egypt-ai-core
```
**2. Install dependencies:**
```bash
pip install -r requirements.txt
```
**3. Provide Model Weights:**
The base SeamlessM4T-v2-Large model weights download autonomously from Hugging Face on the first run. Place your trained QLoRA adapter in a directory named qlora_adapter_final in the project root. If this folder is missing, the API safely falls back to the base model.
**4. Boot the API:**
```bash
python api/main.py
```
## Endpoints
POST /translate/audio
Accepts mu …