verisight 2.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- backend/__init__.py +88 -0
- backend/agent.py +634 -0
- backend/aws_adapter.py +248 -0
- backend/benchmark_runner.py +66 -0
- backend/cli.py +132 -0
- backend/forensics.py +813 -0
- backend/generate_demo_samples.py +25 -0
- backend/generate_real_life_samples.py +175 -0
- backend/main.py +538 -0
- backend/mcp_server.py +336 -0
- backend/test_mcp_tools.py +132 -0
- backend/test_sanity.py +315 -0
- verisight-2.2.0.dist-info/METADATA +391 -0
- verisight-2.2.0.dist-info/RECORD +18 -0
- verisight-2.2.0.dist-info/WHEEL +5 -0
- verisight-2.2.0.dist-info/entry_points.txt +2 -0
- verisight-2.2.0.dist-info/licenses/LICENSE +190 -0
- verisight-2.2.0.dist-info/top_level.txt +1 -0
backend/__init__.py
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"""
|
|
2
|
+
VeriSight MCP — Autonomous Multi-Spectral Image Forensics Engine
|
|
3
|
+
Powered by OpenCV 5 + Model Context Protocol (MCP)
|
|
4
|
+
Author: Aditya Raj Tiwari <adityasantosh2026@gmail.com>
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
import sys
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from typing import Dict, Any, Union
|
|
12
|
+
import numpy as np
|
|
13
|
+
import cv2
|
|
14
|
+
|
|
15
|
+
# Ensure backend root is in sys.path
|
|
16
|
+
_current_dir = str(Path(__file__).resolve().parent)
|
|
17
|
+
if _current_dir not in sys.path:
|
|
18
|
+
sys.path.insert(0, _current_dir)
|
|
19
|
+
|
|
20
|
+
from agent import ForensicAgent, forensic_agent
|
|
21
|
+
from forensics import (
|
|
22
|
+
tool_global_ela_scan,
|
|
23
|
+
tool_roi_fourier_probe,
|
|
24
|
+
tool_gradient_chrominance_check,
|
|
25
|
+
tool_sweep_jpeg_ghosts,
|
|
26
|
+
tool_sensor_noise_probe,
|
|
27
|
+
tool_recapture_pad_analysis,
|
|
28
|
+
tool_vehicle_damage_verification,
|
|
29
|
+
tool_semantic_scene_triage,
|
|
30
|
+
tool_perceptual_hash
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
__version__ = "2.2.0"
|
|
34
|
+
__author__ = "Aditya Raj Tiwari"
|
|
35
|
+
__license__ = "Apache-2.0"
|
|
36
|
+
|
|
37
|
+
def scan_image(
|
|
38
|
+
image_input: Union[str, np.ndarray, bytes],
|
|
39
|
+
claim_type: str = "Quick-Commerce / Auto Insurance Claim",
|
|
40
|
+
sensitivity: str = "balanced"
|
|
41
|
+
) -> Dict[str, Any]:
|
|
42
|
+
"""
|
|
43
|
+
Primary 1-line Python SDK entry point for VeriSight multi-spectral forensics.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
image_input: File path (str), NumPy BGR image array, or raw bytes.
|
|
47
|
+
claim_type: Domain category for semantic subject triage.
|
|
48
|
+
sensitivity: 'conservative', 'balanced', or 'aggressive'.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
Dict containing verdict, tamper_probability, ROI coordinates, and multi-spectral metrics.
|
|
52
|
+
"""
|
|
53
|
+
raw_bytes = None
|
|
54
|
+
if isinstance(image_input, str):
|
|
55
|
+
if not os.path.exists(image_input):
|
|
56
|
+
raise FileNotFoundError(f"Image not found at path: {image_input}")
|
|
57
|
+
with open(image_input, "rb") as f:
|
|
58
|
+
raw_bytes = f.read()
|
|
59
|
+
img = cv2.imread(image_input, cv2.IMREAD_COLOR)
|
|
60
|
+
if img is None:
|
|
61
|
+
raise ValueError(f"OpenCV failed to decode image: {image_input}")
|
|
62
|
+
elif isinstance(image_input, bytes):
|
|
63
|
+
raw_bytes = image_input
|
|
64
|
+
np_arr = np.frombuffer(image_input, np.uint8)
|
|
65
|
+
img = cv2.imdecode(np_arr, cv2.IMREAD_COLOR)
|
|
66
|
+
if img is None:
|
|
67
|
+
raise ValueError("OpenCV failed to decode byte stream into valid image array.")
|
|
68
|
+
elif isinstance(image_input, np.ndarray):
|
|
69
|
+
img = image_input
|
|
70
|
+
else:
|
|
71
|
+
raise TypeError(f"Unsupported image_input type: {type(image_input)}")
|
|
72
|
+
|
|
73
|
+
return forensic_agent.run_investigation(
|
|
74
|
+
img,
|
|
75
|
+
raw_bytes=raw_bytes,
|
|
76
|
+
claim_type=claim_type,
|
|
77
|
+
sensitivity=sensitivity
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
verify_claim = scan_image
|
|
81
|
+
|
|
82
|
+
__all__ = [
|
|
83
|
+
"scan_image",
|
|
84
|
+
"verify_claim",
|
|
85
|
+
"forensic_agent",
|
|
86
|
+
"ForensicAgent",
|
|
87
|
+
"__version__"
|
|
88
|
+
]
|