| import os | |
| import sys | |
| import app.bootstrap | |
| import json | |
| from app.face_emotion import extract_face_emotion | |
| #from app.config import DEEPFACE_MODEL_PATH | |
| from app.logger import log | |
| #from deepface import DeepFace | |
| def extract_emotion(): | |
| if len(sys.argv) < 2: | |
| #print("__RESULT__") | |
| print(json.dumps({ | |
| "status": "error", | |
| "error": "video_path não informado" | |
| })) | |
| sys.exit(1) | |
| video_path = sys.argv[1] | |
| try: | |
| final_emotion = extract_face_emotion(video_path) | |
| #print("__RESULT__") | |
| print(json.dumps({ | |
| "status": "ok", | |
| "emotion": final_emotion | |
| })) | |
| except Exception as e: | |
| #print("__RESULT__") | |
| print(json.dumps({ | |
| "status": "error", | |
| "error": str(e) | |
| })) | |
| sys.exit(1) | |
| if __name__ == "__main__": | |
| extract_emotion() |