File size: 752 Bytes
88ce322 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import requests
import sys
# Test the health endpoint first
print("Testing health endpoint...")
response = requests.get("http://127.0.0.1:8000/")
print(f"Status: {response.status_code}")
print(f"Response: {response.json()}")
# Test face recognition with an image
if len(sys.argv) > 1:
img_path = sys.argv[1]
print(f"\nTesting face recognition with: {img_path}")
with open(img_path, "rb") as f:
files = {"file": f}
response = requests.post("http://127.0.0.1:8000/recognize", files=files)
print(f"Status: {response.status_code}")
print(f"Response: {response.json()}")
else:
print("\nTo test face recognition, provide an image path:")
print("python test_api.py <image_path>")
|