Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InternVideo2-6B Simple Deployment

Minimal deployment of InternVideo2-6B with WebSocket for real-time video Q&A.

🚀 Quick Start

1. Install Dependencies

bash install.sh

Or manually:

pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu118
pip3 install -r requirements.txt

2. Run Server

bash run.sh

Or directly:

python3 app.py

3. Open Browser

Navigate to http://localhost:8000

📱 How to Use

Web Interface (Easiest)

  1. Open http://localhost:8000 in your browser
  2. Upload a video file
  3. Ask questions in the chat interface
  4. Get real-time answers

Python Client

python3 test_client.py

Manual WebSocket Connection

import asyncio
import websockets
import json

async def ask_question():
    # First upload video via HTTP POST to /upload
    # Get video_id from response
    
    # Connect to WebSocket
    uri = f"ws://localhost:8000/ws/{video_id}"
    async with websockets.connect(uri) as ws:
        # Send question
        await ws.send(json.dumps({"question": "What is in this video?"}))
        
        # Get answer
        response = await ws.recv()
        data = json.loads(response)
        print(f"Answer: {data['answer']}")
        print(f"Confidence: {data['confidence']}")

asyncio.run(ask_question())

🎯 Features

  • ✅ Simple single-file deployment
  • ✅ Real-time WebSocket Q&A
  • ✅ Web interface included
  • ✅ No Docker required
  • ✅ Minimal dependencies
  • ✅ GPU optimized (80GB VRAM)

📋 API Endpoints

Endpoint Method Description
/ GET Web interface
/upload POST Upload video
/ws/{video_id} WS WebSocket Q&A
/health GET Health check

💬 Example Q&A

Q: What is happening in this video?
A: The person is walking
   (Confidence: 92.3%)

Q: How many people are there?
A: Two
   (Confidence: 87.5%)

Q: Where does this take place?
A: Indoors
   (Confidence: 95.1%)

🔧 Configuration

Edit these variables in app.py:

DEVICE = "cuda"  # or "cpu"
MODEL_NAME = "OpenGVLab/InternVideo2-Stage2_6B"
TEMP_DIR = Path("./temp_videos")

📊 System Requirements

  • Python 3.8+
  • CUDA 11.7+ (for GPU)
  • 30-40GB GPU memory for 6B model
  • 16GB RAM minimum

🐛 Troubleshooting

  1. CUDA not found: Install NVIDIA drivers and CUDA toolkit
  2. Out of memory: Model requires ~30GB VRAM
  3. Import errors: Run pip3 install -r requirements.txt
  4. Port in use: Change port in app.py last line

📝 Notes

  • Videos are temporarily stored in temp_videos/
  • Cached features improve response time
  • WebSocket maintains persistent connection
  • Supports MP4, AVI, MOV, MKV formats

🚦 Status

Check server status: http://localhost:8000/health

{
  "status": "healthy",
  "device": "cuda",
  "model_loaded": true,
  "videos_cached": 2
}

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages