| import subprocess | |
| def run_script(script_path): | |
| print(f"\n🔹 Đang chạy: {script_path}") | |
| result = subprocess.run(["python", script_path], capture_output=True, text=True) | |
| if result.returncode == 0: | |
| print(f"✅ Hoàn thành: {script_path}\n") | |
| else: | |
| print(f"❌ Lỗi khi chạy {script_path}:\n{result.stderr}\n") | |
| if __name__ == "__main__": | |
| # Danh sách file cần chạy tuần tự | |
| scripts = [ | |
| "segmentation/u2net_test.py", | |
| "segmentation/sam_guide.py", | |
| "segmentation/sam_predict.py", | |
| "segmentation/make_final_mask.py", | |
| "alopecia/calculate_hair_thickness.py", | |
| "alopecia/calculate_hair_count.py" | |
| ] | |
| for script in scripts: | |
| run_script(script) | |
| print("🎉 Hoàn tất toàn bộ quy trình!") | |