--- title: Assistive Diagnostic Framework for Copyright emoji: ⚖️ colorFrom: gray colorTo: blue sdk: gradio sdk_version: 6.14.0 python_version: 3.10.14 app_file: app.py pinned: false license: mit --- # Assistive Diagnostic Framework for Copyright Infringement This prototype application is an "Explainable AI" dashboard designed to assist in evaluating potential visual copyright infringement. Rather than outputting a single, opaque similarity score, this tool processes two images through a multi-model computer vision pipeline to map technical parameters to established legal criteria. ## 🧠 The Architecture The pipeline divides the visual comparison into three distinct legal dimensions, optimized to run within standard memory constraints (e.g., Hugging Face Free Tier). 1. **Semantic Match (The "Idea" Filter)** * **Model:** CLIP (`openai/clip-vit-base-patch32`) * **Function:** Compares the overarching semantic concept of the images. This acts as a threshold mechanism to determine if the images share the same unprotected subject matter or "referent" before analyzing specific expressions. 2. **Structural Layout (Substantial Similarity)** * **Model:** OpenCV Canny Edge Detection * **Function:** Strips away style, texture, and color to compare only the fundamental structural outlines. Calculates the Intersection over Union (IoU) of the edge pixels to assess compositional overlap. 3. **Patch Match (Fragmented Literal Similarity)** * **Model:** DINOv2 (`facebook/dinov2-base`) * **Function:** Identifies "scattered literal copying." By extracting and normalizing local patch features, the model uses a Mutual Nearest Neighbors algorithm to map identical or near-identical fragments between the two images, regardless of their spatial location. ## 🚀 Running Locally To run this application on your local machine, ensure you have Python 3.9+ installed. 1. Clone the repository: ```bash git clone cd