Download backend/scripts/v2_final_acceptance.py from YVES28/lerningOs: direct link, hf CLI and curl.
- Browser
- Download file 2.85 kB
-
https://huggingface.co/spaces/YVES28/lerningOs/resolve/main/backend/scripts/v2_final_acceptance.py
- Command line
-
hf download hf://spaces/YVES28/lerningOs/backend/scripts/v2_final_acceptance.py
-
curl -L -o v2_final_acceptance.py https://huggingface.co/spaces/YVES28/lerningOs/resolve/main/backend/scripts/v2_final_acceptance.py
2.85 kB
| import asyncio | |
| import json | |
| import time | |
| import requests | |
| import logging | |
| logging.basicConfig(level=logging.INFO, format="%(asctime)s - [%(levelname)s] - %(message)s") | |
| logger = logging.getLogger("V2AcceptanceVerifier") | |
| BASE_URL = "http://localhost:8000" | |
| def verify_v2_acceptance_suite(): | |
| logger.info("=================================================================") | |
| logger.info(" 12D AI Assessment Engine V2.0 Final Acceptance Verification ") | |
| logger.info("=================================================================") | |
| # 1. 基础服务存活检测 | |
| logger.info("\n[1/4] Checking System V2.0 Health & Prometheus Metrics...") | |
| r = requests.get(f"{BASE_URL}/health") | |
| assert r.status_code == 200, f"Health check failed: {r.text}" | |
| logger.info(f"Health Response: {r.json()}") | |
| # 2. 模拟加载 Multi-Agent 诊断会商服务 (DSM-5 / ICD-11) | |
| logger.info("\n[2/4] Testing DSM-5 / ICD-11 Multi-Agent Clinical Consensus...") | |
| from app.agents.clinical_consensus import ClinicalMultiAgentSystem | |
| class MockVectorStore: | |
| def search(self, query: str, top_k: int = 3): | |
| class Doc: | |
| text = "DSM-5 315.4 (Developmental Coordination Disorder) & ICD-11 6A05." | |
| return [Doc()] | |
| agent_system = ClinicalMultiAgentSystem(vector_store_client=MockVectorStore()) | |
| scores = {"Executive_Function": -2.1, "Attention_Control": -1.8, "Visual_Spatial": 0.5} | |
| report = agent_system.execute_consensus_diagnosis({"age_months": 72}, scores) | |
| assert "primary_diagnostic_impression" in report | |
| assert len(report["clinical_interventions"]) > 0 | |
| logger.info(f"Generated Clinical Impression: {report['primary_diagnostic_impression']}") | |
| logger.info(f"Aligned Guidelines: {report['dsm5_icd11_alignment']}") | |
| # 3. 多模态融合引擎测试 | |
| logger.info("\n[3/4] Verifying Multimodal Fusion Engine (Gaze, AU, Audio)...") | |
| from app.schemas.multimodal import MultimodalFramePayload, EyeTrackingPoint, MicroExpressionAU | |
| from app.services.multimodal_fusion import MultimodalFusionEngine | |
| payload = MultimodalFramePayload( | |
| session_id="v2_test_sess", | |
| item_id="item_v2_001", | |
| gaze_stream=[EyeTrackingPoint(x=0.5, y=0.5, pupil_dilation=4.8, timestamp_ms=100)], | |
| micro_expressions=[MicroExpressionAU(action_unit="AU04", intensity=0.9)], | |
| audio_metrics=None, | |
| captured_at="2026-07-29T10:00:00Z" | |
| ) | |
| cli_score = MultimodalFusionEngine.calculate_cognitive_load(payload) | |
| logger.info(f"Calculated Cognitive Load Index (CLI): {cli_score}") | |
| assert cli_score > 0.5 | |
| # 4. 总结 | |
| logger.info("\n[4/4] Final Verification Passed!") | |
| logger.info("🎉 12D AI Assessment Engine V2.0 GA is READY FOR PRODUCTION DEPLOYMENT!") | |
| if __name__ == "__main__": | |
| verify_v2_acceptance_suite() | |