LPX55
commited on
Commit
·
25ba4f3
1
Parent(s):
1e3b472
Implement code changes to enhance functionality and improve performance
Browse files
.github/instructions/context.instructions.md
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
```instructions
|
2 |
+
# Using context7 for Always-Up-to-Date Documentation
|
3 |
+
|
4 |
+
To ensure you always access the latest documentation for any library or tool, use the context7 system as follows:
|
5 |
+
|
6 |
+
1. **Resolve the Library ID:**
|
7 |
+
- Use the `mcp_context7_resolve-library-id` tool with the library name to get the exact Context7-compatible library ID.
|
8 |
+
- Example:
|
9 |
+
- Input: `libraryName: "gradio"`
|
10 |
+
- Output: `/gradio/gradio` (or similar)
|
11 |
+
|
12 |
+
2. **Fetch the Latest Documentation:**
|
13 |
+
- Use the `mcp_context7_get-library-docs` tool with the resolved library ID.
|
14 |
+
- You can specify a topic (e.g., "hooks", "routing") or leave it blank for general docs.
|
15 |
+
- Example:
|
16 |
+
- Input: `context7CompatibleLibraryID: "/gradio/gradio"`
|
17 |
+
- Output: Latest documentation content
|
18 |
+
|
19 |
+
3. **Best Practices:**
|
20 |
+
- Always resolve the library ID first, unless you already have a valid Context7-compatible ID.
|
21 |
+
- For ambiguous or generic queries, clarify the library or topic before fetching docs.
|
22 |
+
- Use the `tokens` parameter to control the amount of documentation returned (default: 10,000 tokens).
|
23 |
+
|
24 |
+
4. **Summary:**
|
25 |
+
- This workflow guarantees you are referencing the most current and authoritative documentation for any supported library, directly from the source.
|
26 |
+
```
|
.github/instructions/copilot-instructions.md
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
# Copilot Instructions for OpenSight-Deepfake-Detection-Models-Playground
|
3 |
+
|
4 |
+
## Project Overview
|
5 |
+
This project is a modular, agent-driven toolkit for deepfake detection and digital forensics. It uses an ensemble of models, advanced forensic tools, and smart agents to provide explainable, extensible, and robust detection—optimized for integration with vision LLMs and multimodal AI agents.
|
6 |
+
|
7 |
+
## Architecture & Key Components
|
8 |
+
- **Entrypoint:** `app.py` (Gradio app + MCP server).
|
9 |
+
- **Forensics:** `forensics/` (e.g., `ela.py`, `gradient.py`, `minmax.py`, `bitplane.py`, `wavelet.py`). Each file implements a forensic technique, callable via LLM/MCP.
|
10 |
+
- **Agents:** `agents/` (e.g., `EnsembleMonitorAgent`, `ModelWeightManager`, `ContextualIntelligenceAgent`, `ForensicAnomalyDetectionAgent`). Agents coordinate model weighting, context inference, and anomaly detection.
|
11 |
+
- **Model Management:** Models are registered in `utils/registry.py` and managed as an ensemble with dynamic, context-aware weighting.
|
12 |
+
- **Utilities:** `utils/` (logging, augmentation, registry, health checks).
|
13 |
+
|
14 |
+
## Data Flow & Prediction Pipeline
|
15 |
+
1. **Image Preprocessing:** Normalize to PIL RGB; optionally augment (rotate, noise, sharpen).
|
16 |
+
2. **Agent Initialization:** Monitoring, optimization, and context agents are set up.
|
17 |
+
3. **Model Inference:** Each model predicts independently; results tracked by agents.
|
18 |
+
4. **Consensus:** Model weights are dynamically adjusted based on context and agent feedback.
|
19 |
+
5. **Forensic Analysis:** Multiple forensic tools run in parallel; outputs analyzed for anomalies.
|
20 |
+
6. **Logging:** All results (images, predictions, agent data) are logged to Hugging Face datasets.
|
21 |
+
|
22 |
+
## Developer Workflows
|
23 |
+
- **Run the App:**
|
24 |
+
```bash
|
25 |
+
python app_optimized.py
|
26 |
+
```
|
27 |
+
- **Dependencies:** See `requirements.txt` (notably: gradio, PIL, numpy, torch, smolagents, etc.).
|
28 |
+
- **Extending Forensics/Agents:** Add new tools in `forensics/`, new agents in `agents/`, and register in the main app.
|
29 |
+
- **Testing:** Unit tests for agents/models are planned (see roadmap in `README.md`).
|
30 |
+
|
31 |
+
## Project-Specific Patterns & Conventions
|
32 |
+
- **Forensic Tool Naming:** Use `tool_*` or descriptive names (e.g., `tool_ela`, `tool_waveletnoise`).
|
33 |
+
- **Agent Classes:** Use `*Agent` suffix (e.g., `EnsembleMonitorAgent`).
|
34 |
+
- **API Exposure:** Functions are exposed for LLM/MCP calls with clear parameter/return docs (see `README.md`).
|
35 |
+
- **Consensus Logic:** Model weights are contextually adjusted; see agent code for dynamic weighting.
|
36 |
+
- **Logging:** Inference data is logged to Hugging Face datasets for analysis.
|
37 |
+
|
38 |
+
## Integration & Extension
|
39 |
+
- **Add Models:** Update ensemble logic and register in agent system.
|
40 |
+
- **Add Forensic Tools:** Implement in `forensics/`, expose via main app, and document parameters/returns.
|
41 |
+
- **LLM/Multimodal Integration:** Hybrid input strategies (e.g., ELA+RGB, metadata+image) are encouraged; see `README.md` for detailed tables and guidance.
|
42 |
+
|
43 |
+
## References
|
44 |
+
- **Forensic Techniques:** See `forensics/` for implementation details.
|
45 |
+
- **Agent Logic:** See `agents/` for smart agent patterns.
|
46 |
+
- **API & Usage:** `README.md` documents all callable functions, parameters, and return types.
|
47 |
+
- **Roadmap:** Ongoing and planned features are tracked in `README.md`.
|
48 |
+
|
49 |
+
---
|
50 |
+
**Tip:** When extending or debugging, always check agent logic and consensus weighting, as these are central to system behavior.
|
uv.lock
ADDED
The diff for this file is too large to render.
See raw diff
|
|