A hybrid AI-powered system designed to protect intellectual property and detect unauthorized media clones.
Median is an enterprise-grade media similarity engine designed to stop copyright infringement, deepfakes, and unauthorized asset usage.
Instead of relying on basic metadata, Median uses a multi-layered AI pipeline to "look" at an image and understand its structure and meaning.
Median solves the massive computational cost of similarity searches by blending traditional perceptual hashing with modern Deep Learning:
- Velocity Layer (pHash): Evaluates exact perceptual similarity of an image in
O(N)time. This acts as an ultra-fast pre-filter, dropping the search space down to the top 5 candidates. - Semantic Layer (Vertex AI Multimodal Embeddings): Generates a 1408-dimensional vector representing the core "meaning" and visual style of the image. A cosine distance calculation is performed against the top candidates.
- Reasoning Layer (Gemini 2.0 Flash): Evaluates the blended scores and securely generates a human-readable explanation of why an image is flagged as "Unauthorized" or "Safe".
- Graceful Degradation: Built for production. If Google AI APIs timeout or fail, the system instantly falls back to pHash-only matching, ensuring zero downtime.
- Deterministic Output: Uses prompt-engineering and temperature controls on Gemini to prevent AI hallucinations, ensuring the "explanations" are strictly grounded in mathematical confidence scores.
- Scalable Pipeline: Uses top-K approximate filtering before running heavy vector math.
- Oversized Payload Guards: Built-in network middleware rejecting files >10MB at the border line to protect backend memory.
- Frontend: React, Vite, Tailwind CSS, TypeScript
- Backend: Python, FastAPI, SQLite (Local Data Storage)
- AI & Cloud Services:
- Google Cloud Vertex AI:
multimodalembedding@001 - Google Generative AI:
gemini-2.0-flash - pHash (ImageHash): Structural filtering
- Google Cloud Vertex AI:
Ensure you have Python 3.10+ installed. You will need a Google Cloud Project with the Vertex AI API enabled.
# Navigate to backend
cd backend
# Create virtual environment and install dependencies
python -m venv venv
source venv/bin/activate # (On Windows: venv\Scripts\activate)
pip install -r requirements.txt🔑 Authentication Details: Create a
.envfile in thebackend/directory:GOOGLE_APPLICATION_CREDENTIALS=../key.json GOOGLE_CLOUD_PROJECT=your-project-id GEMINI_MODEL=gemini-2.0-flash MAX_UPLOAD_SIZE=10485760(Ensure your GCP
key.jsonis sitting in the root folder!)
Run the backend server:
python main.pyThe backend will boot up at http://localhost:8000 with full Swagger docs available at /docs.
Open a new terminal.
# Install dependencies
npm install
# Start development server
npm run devThe frontend will be available at http://localhost:8080 (or the port defined by Vite).
- A creator uploads an original artwork (e.g., a drawing of a sci-fi city).
- Median processes it in milliseconds, extracting the pHash and Vertex AI Embedding, and indexing it into the database.
- A bad actor crops, slightly recolors, or alters the same artwork and attempts to upload it.
- Median scans the file. The pHash triggers a structural warning, while Vertex AI flags a 99% semantic match.
- Gemini Flash compiles this data and throws an Unauthorized alert with a detailed summary. The bad actor is blocked.