-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_api_debug.py
More file actions
67 lines (56 loc) · 2.08 KB
/
Copy pathtest_api_debug.py
File metadata and controls
67 lines (56 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import requests
from pathlib import Path
# Your image paths
face_path = "C:\\Users\\USER\\chan1.jpg"
sig_path = "C:\\Users\\USER\\sg1.png"
print("="*60)
print("TESTING MULTIMODAL BIOMETRICS API")
print("="*60)
# Check if files exist
if not Path(face_path).exists():
print(f"❌ Face image not found: {face_path}")
exit(1)
else:
print(f"✓ Face image found: {face_path}")
if not Path(sig_path).exists():
print(f"❌ Signature image not found: {sig_path}")
exit(1)
else:
print(f"✓ Signature image found: {sig_path}")
print("\n" + "="*60)
print("SENDING REQUEST TO API")
print("="*60)
try:
# Prepare files for upload
with open(face_path, 'rb') as face_file, open(sig_path, 'rb') as sig_file:
files = {
'face': ('face.jpg', face_file, 'image/jpeg'),
'signature': ('signature.png', sig_file, 'image/png')
}
print("\nVerifying identity...")
print(" Face: chan1.jpg")
print(" Signature: sg1.png")
print("\nCalling: POST http://localhost:8000/verify")
response = requests.post('http://localhost:8000/verify', files=files)
print(f"\nStatus Code: {response.status_code}")
if response.status_code == 200:
result = response.json()
print("\n" + "="*60)
print("✓ VERIFICATION RESULT")
print("="*60)
print(f"Decision: {result['decision']}")
print(f"Confidence: {result['confidence']:.2%}")
print(f"Face Score: {result['face_score']:.4f}")
print(f"Signature Score: {result['signature_score']:.4f}")
print(f"Final Score: {result['final_score']:.4f}")
print("="*60)
else:
print(f"\n❌ Error: {response.status_code}")
print(f"Response: {response.json()}")
except requests.exceptions.ConnectionError:
print("\n❌ Could not connect to API at http://localhost:8000")
print("Make sure backend is running:")
print(" cd backend")
print(" python main.py")
except Exception as e:
print(f"\n❌ Error: {e}")