| import sys | |
| sys.path.append("c:/Users/Vasanth kumar/OneDrive/Desktop/new_clg_project/backend") | |
| import numpy as np | |
| import cv2 | |
| import json | |
| import traceback | |
| try: | |
| from models.face_mesh import process_frame | |
| from models.face_model import predict_emotion | |
| frame = np.random.randint(0, 255, (480, 640, 3), dtype=np.uint8) | |
| print("Testing process_frame...") | |
| mesh_result = process_frame(frame) | |
| print("Mesh:", "Success" if "detected" in mesh_result else "Fail") | |
| print("Testing predict_emotion...") | |
| landmarks = [{'x': 0.5, 'y': 0.5, 'z': 0}] * 468 | |
| res = predict_emotion(frame, landmarks) | |
| print("Dict Output:", res) | |
| print("Testing JSON Serialization (FastAPI behavior)...") | |
| json.dumps(res) | |
| print("JSON Serialization OK!") | |
| except Exception as e: | |
| traceback.print_exc() | |