Spaces:
Configuration error
Configuration error
Delete readme_md.txt
Browse files- readme_md.txt +0 -294
readme_md.txt
DELETED
|
@@ -1,294 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: CineAI — Free AI Video Assistant
|
| 3 |
-
emoji: 🎬
|
| 4 |
-
colorFrom: purple
|
| 5 |
-
colorTo: blue
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version: 4.44.0
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: true
|
| 10 |
-
license: mit
|
| 11 |
-
hardware: cpu-upgrade
|
| 12 |
-
suggested_hardware: t4-small
|
| 13 |
-
short_description: Upload any movie/video — AI explains scenes, chats in Hindi, speaks responses
|
| 14 |
-
tags:
|
| 15 |
-
- video-understanding
|
| 16 |
-
- hindi
|
| 17 |
-
- movie
|
| 18 |
-
- chatbot
|
| 19 |
-
- multimodal
|
| 20 |
-
- whisper
|
| 21 |
-
- blip2
|
| 22 |
-
- phi3
|
| 23 |
-
- tts
|
| 24 |
-
- faiss
|
| 25 |
-
---
|
| 26 |
-
|
| 27 |
-
# 🎬 CineAI — Free AI Video Assistant
|
| 28 |
-
|
| 29 |
-
> Upload any movie or video. AI understands it completely — scenes, dialogue, characters, emotions. Chat about it in English or Hindi. Get voice responses.
|
| 30 |
-
|
| 31 |
-
---
|
| 32 |
-
|
| 33 |
-
## ✨ Features
|
| 34 |
-
|
| 35 |
-
| Feature | Details |
|
| 36 |
-
|---------|---------|
|
| 37 |
-
| 🎤 Speech Recognition | faster-whisper (tiny/base/small, auto-selected) |
|
| 38 |
-
| 👁️ Vision Understanding | BLIP-2 or BLIP-base scene captioning |
|
| 39 |
-
| 💬 Chat AI | Phi-3-mini or TinyLlama instruct |
|
| 40 |
-
| 🇮🇳 Hindi Translation | NLLB-200-distilled-600M (200 languages) |
|
| 41 |
-
| 🔊 Voice Output | Coqui TTS (English + multilingual) |
|
| 42 |
-
| 🧠 Memory | FAISS vector store + semantic retrieval |
|
| 43 |
-
| 🔍 Web Search | DuckDuckGo (no API key) |
|
| 44 |
-
| 🔐 Privacy | Session-scoped temp storage, auto-deleted |
|
| 45 |
-
|
| 46 |
-
---
|
| 47 |
-
|
| 48 |
-
## 🏗️ Architecture
|
| 49 |
-
|
| 50 |
-
```
|
| 51 |
-
User uploads video
|
| 52 |
-
│
|
| 53 |
-
▼
|
| 54 |
-
┌─────────────────────────────────────────┐
|
| 55 |
-
│ VideoProcessor │
|
| 56 |
-
│ • FFmpeg: extract audio + frames │
|
| 57 |
-
│ • Adaptive sampling (3-10 fps) │
|
| 58 |
-
│ • Scene-change detection │
|
| 59 |
-
└───────┬──────────────────────┬──────────┘
|
| 60 |
-
│ │
|
| 61 |
-
▼ ▼
|
| 62 |
-
┌───────────────┐ ┌──────────────────┐
|
| 63 |
-
│ SpeechToText │ │ VisionAnalyzer │
|
| 64 |
-
│ faster-whisper│ │ BLIP-2 captions │
|
| 65 |
-
│ timestamped │ │ per frame │
|
| 66 |
-
└───────┬───────┘ └────────┬─────────┘
|
| 67 |
-
│ │
|
| 68 |
-
└──────────┬──────────┘
|
| 69 |
-
▼
|
| 70 |
-
┌─────────────────┐
|
| 71 |
-
│ MemoryStore │
|
| 72 |
-
│ FAISS + SBERT │
|
| 73 |
-
│ embeddings │
|
| 74 |
-
└────────┬────────┘
|
| 75 |
-
│
|
| 76 |
-
┌────────▼────────┐
|
| 77 |
-
│ CineAIChatbot │◄── WebSearcher (DDG)
|
| 78 |
-
│ Phi-3-mini │
|
| 79 |
-
│ streaming │
|
| 80 |
-
└────────┬────────┘
|
| 81 |
-
│
|
| 82 |
-
┌────────▼────────┐ ┌──────────────┐
|
| 83 |
-
│ Translator │ │ TTSEngine │
|
| 84 |
-
│ NLLB-600M │ │ Coqui TTS │
|
| 85 |
-
└─────────────────┘ └──────────────┘
|
| 86 |
-
```
|
| 87 |
-
|
| 88 |
-
---
|
| 89 |
-
|
| 90 |
-
## 🚀 Quick Start — Local
|
| 91 |
-
|
| 92 |
-
### Prerequisites
|
| 93 |
-
- Python 3.10+
|
| 94 |
-
- FFmpeg installed (`sudo apt install ffmpeg` / `brew install ffmpeg`)
|
| 95 |
-
- 16 GB RAM recommended
|
| 96 |
-
|
| 97 |
-
### Installation
|
| 98 |
-
|
| 99 |
-
```bash
|
| 100 |
-
# Clone the repo
|
| 101 |
-
git clone https://huggingface.co/spaces/YOUR_USERNAME/cineai
|
| 102 |
-
cd cineai
|
| 103 |
-
|
| 104 |
-
# Create virtual environment
|
| 105 |
-
python -m venv venv
|
| 106 |
-
source venv/bin/activate # Windows: venv\Scripts\activate
|
| 107 |
-
|
| 108 |
-
# Install dependencies
|
| 109 |
-
pip install --upgrade pip
|
| 110 |
-
pip install -r requirements.txt
|
| 111 |
-
|
| 112 |
-
# Run
|
| 113 |
-
python app.py
|
| 114 |
-
```
|
| 115 |
-
|
| 116 |
-
Open `http://localhost:7860` in your browser.
|
| 117 |
-
|
| 118 |
-
### GPU Support (optional)
|
| 119 |
-
|
| 120 |
-
If you have an NVIDIA GPU with CUDA 12.x:
|
| 121 |
-
|
| 122 |
-
```bash
|
| 123 |
-
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
|
| 124 |
-
pip install bitsandbytes # for 4-bit quantization
|
| 125 |
-
```
|
| 126 |
-
|
| 127 |
-
Models will automatically use GPU when available.
|
| 128 |
-
|
| 129 |
-
---
|
| 130 |
-
|
| 131 |
-
## 🤗 Hugging Face Spaces Deployment
|
| 132 |
-
|
| 133 |
-
### Method 1: Direct Upload (Recommended)
|
| 134 |
-
|
| 135 |
-
1. Go to [huggingface.co/new-space](https://huggingface.co/new-space)
|
| 136 |
-
2. Choose:
|
| 137 |
-
- **SDK**: Gradio
|
| 138 |
-
- **Hardware**: CPU Upgrade (free) or T4 Small (GPU, faster)
|
| 139 |
-
3. Upload all project files
|
| 140 |
-
4. Space auto-builds and deploys
|
| 141 |
-
|
| 142 |
-
### Method 2: Git Push
|
| 143 |
-
|
| 144 |
-
```bash
|
| 145 |
-
# Install HF CLI
|
| 146 |
-
pip install huggingface_hub
|
| 147 |
-
|
| 148 |
-
# Login
|
| 149 |
-
huggingface-cli login
|
| 150 |
-
|
| 151 |
-
# Create space
|
| 152 |
-
huggingface-cli repo create cineai --type space --space-sdk gradio
|
| 153 |
-
|
| 154 |
-
# Push
|
| 155 |
-
git init
|
| 156 |
-
git remote add origin https://huggingface.co/spaces/YOUR_USERNAME/cineai
|
| 157 |
-
git add .
|
| 158 |
-
git commit -m "Initial CineAI deployment"
|
| 159 |
-
git push origin main
|
| 160 |
-
```
|
| 161 |
-
|
| 162 |
-
### Method 3: Docker (Self-hosted)
|
| 163 |
-
|
| 164 |
-
```bash
|
| 165 |
-
docker build -t cineai .
|
| 166 |
-
docker run -p 7860:7860 --memory=16g cineai
|
| 167 |
-
```
|
| 168 |
-
|
| 169 |
-
---
|
| 170 |
-
|
| 171 |
-
## 🧠 Model Download Sizes
|
| 172 |
-
|
| 173 |
-
All models are downloaded automatically on first run and cached:
|
| 174 |
-
|
| 175 |
-
| Model | Size | Use |
|
| 176 |
-
|-------|------|-----|
|
| 177 |
-
| faster-whisper-base | ~150 MB | Speech recognition |
|
| 178 |
-
| BLIP-2-opt-2.7b | ~5.5 GB | Scene understanding |
|
| 179 |
-
| Phi-3-mini-4k-instruct | ~7.6 GB | Chat AI |
|
| 180 |
-
| NLLB-200-distilled-600M | ~1.2 GB | Hindi translation |
|
| 181 |
-
| all-MiniLM-L6-v2 | ~22 MB | Memory embeddings |
|
| 182 |
-
| Coqui TTS | ~100 MB | Voice output |
|
| 183 |
-
|
| 184 |
-
**Total first-run download: ~15 GB** (cached for subsequent runs)
|
| 185 |
-
|
| 186 |
-
> On HF Spaces with persistent storage, models cache between restarts.
|
| 187 |
-
|
| 188 |
-
---
|
| 189 |
-
|
| 190 |
-
## ⚙️ RAM Optimization Tips
|
| 191 |
-
|
| 192 |
-
### For 16 GB RAM (HF Free Tier):
|
| 193 |
-
```
|
| 194 |
-
whisper: tiny (39M params) → 150 MB
|
| 195 |
-
BLIP: blip-base → 500 MB (not blip2)
|
| 196 |
-
LLM: TinyLlama-1.1B → 2 GB
|
| 197 |
-
NLLB: 600M distilled → 1.2 GB
|
| 198 |
-
FAISS + embeddings → 300 MB
|
| 199 |
-
Gradio + Python overhead → 1 GB
|
| 200 |
-
─────────────────────────────────────
|
| 201 |
-
Total: ≈ 5 GB ← comfortably fits
|
| 202 |
-
```
|
| 203 |
-
|
| 204 |
-
### For 16-18 GB RAM (HF CPU Upgrade):
|
| 205 |
-
```
|
| 206 |
-
whisper: base → 300 MB
|
| 207 |
-
BLIP-2: opt-2.7b → 6 GB
|
| 208 |
-
LLM: Phi-3-mini (4-bit GPU) → 4 GB
|
| 209 |
-
NLLB: 600M → 1.2 GB
|
| 210 |
-
FAISS → 300 MB
|
| 211 |
-
─────────────────────────────────────
|
| 212 |
-
Total: ≈ 12 GB ← fits with buffer
|
| 213 |
-
```
|
| 214 |
-
|
| 215 |
-
### Environment Variables for Tuning:
|
| 216 |
-
|
| 217 |
-
```bash
|
| 218 |
-
# Reduce session TTL (clean up faster)
|
| 219 |
-
export SESSION_TTL_MINUTES=30
|
| 220 |
-
|
| 221 |
-
# Limit CPU threads
|
| 222 |
-
export OMP_NUM_THREADS=2
|
| 223 |
-
export MKL_NUM_THREADS=2
|
| 224 |
-
|
| 225 |
-
# Custom temp directory
|
| 226 |
-
export CINEAI_TEMP_DIR=/tmp/cineai
|
| 227 |
-
```
|
| 228 |
-
|
| 229 |
-
---
|
| 230 |
-
|
| 231 |
-
## 🔐 Privacy & Security
|
| 232 |
-
|
| 233 |
-
- ✅ No user accounts or login required
|
| 234 |
-
- ✅ Videos stored in isolated `/tmp/cineai/<uuid>/` directories
|
| 235 |
-
- ✅ Automatic deletion after session timeout (default: 60 min)
|
| 236 |
-
- ✅ Background GC sweeps every 5 minutes
|
| 237 |
-
- ✅ Manual "Delete All Session Data" button in UI
|
| 238 |
-
- ✅ No analytics, no tracking, no external data sharing
|
| 239 |
-
- ✅ Session IDs are random UUIDs (unguessable)
|
| 240 |
-
- ✅ All processing happens locally on HF servers
|
| 241 |
-
- ✅ No OpenAI, Google, or any paid API calls
|
| 242 |
-
|
| 243 |
-
---
|
| 244 |
-
|
| 245 |
-
## 📂 Project Structure
|
| 246 |
-
|
| 247 |
-
```
|
| 248 |
-
cineai/
|
| 249 |
-
├── app.py # Gradio UI + event wiring
|
| 250 |
-
├── requirements.txt
|
| 251 |
-
├── Dockerfile
|
| 252 |
-
├── README.md
|
| 253 |
-
├── core/
|
| 254 |
-
│ ├── __init__.py
|
| 255 |
-
│ ├── video_processor.py # FFmpeg pipeline
|
| 256 |
-
│ ├── speech_to_text.py # Whisper ASR
|
| 257 |
-
│ ├── vision_analyzer.py # BLIP-2 scene analysis
|
| 258 |
-
│ ├── translator.py # NLLB Hindi translation
|
| 259 |
-
│ ├── chatbot.py # Phi-3 LLM + streaming
|
| 260 |
-
│ ├── memory.py # FAISS vector memory
|
| 261 |
-
│ ├── web_search.py # DuckDuckGo search
|
| 262 |
-
│ └── tts_engine.py # Coqui TTS
|
| 263 |
-
└── utils/
|
| 264 |
-
├── __init__.py
|
| 265 |
-
├── utils.py # Helpers + monitoring
|
| 266 |
-
└── session_manager.py # Privacy + auto-delete
|
| 267 |
-
```
|
| 268 |
-
|
| 269 |
-
---
|
| 270 |
-
|
| 271 |
-
## 🎯 Example Questions You Can Ask
|
| 272 |
-
|
| 273 |
-
```
|
| 274 |
-
"What happened in this movie?"
|
| 275 |
-
"Who is the main villain and what are his motivations?"
|
| 276 |
-
"Explain the ending — what does it mean?"
|
| 277 |
-
"Translate the dialogue from minute 20 to 30 to Hindi"
|
| 278 |
-
"What's the IMDb rating of this movie?"
|
| 279 |
-
"Summarize the last 10 minutes"
|
| 280 |
-
"What are the hidden themes and symbolism?"
|
| 281 |
-
"Who plays the lead actor?"
|
| 282 |
-
"Explain the twist scene"
|
| 283 |
-
"What was the emotional climax?"
|
| 284 |
-
```
|
| 285 |
-
|
| 286 |
-
---
|
| 287 |
-
|
| 288 |
-
## 📜 License
|
| 289 |
-
|
| 290 |
-
MIT License — Free to use, modify, and deploy.
|
| 291 |
-
|
| 292 |
-
---
|
| 293 |
-
|
| 294 |
-
*Built with ❤️ using Hugging Face Transformers, Gradio, faster-whisper, BLIP-2, Phi-3, NLLB, Coqui TTS, and FAISS.*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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