Spaces:
Sleeping
Sleeping
Download check.py from 1akshith/interior-env: direct link, hf CLI and curl.
- Browser
- Download file 1.51 kB
-
https://huggingface.co/spaces/1akshith/interior-env/resolve/main/check.py
- Command line
-
hf download hf://spaces/1akshith/interior-env/check.py
-
curl -L -o check.py https://huggingface.co/spaces/1akshith/interior-env/resolve/main/check.py
1.51 kB
| import subprocess | |
| import os | |
| print("=" * 50) | |
| print(" Interior Env — Pre-flight Check") | |
| print("=" * 50) | |
| checks = ["Dockerfile", "inference.py", "openenv.yaml"] | |
| all_ok = True | |
| for f in checks: | |
| if os.path.exists(f): | |
| print(f"[OK] {f}") | |
| else: | |
| print(f"[FAIL] {f} missing!") | |
| all_ok = False | |
| if not all_ok: | |
| print("\n[!] Missing critical files. Halting checks.") | |
| exit(1) | |
| print("\n--- Running inference.py local validation ---\n") | |
| try: | |
| result = subprocess.run( | |
| ["python", "inference.py"], | |
| capture_output=True, | |
| text=True, | |
| timeout=15 | |
| ) | |
| stdout = result.stdout | |
| if "[START]" in stdout and "[STEP]" in stdout and "[END]" in stdout: | |
| if "score=0.0000" in stdout: | |
| print("[WARN] inference.py has structured tags but score is 0. Is Baseline working?") | |
| print(f"Stdout summary: {stdout[:800]}") | |
| all_ok = False | |
| else: | |
| print("[OK] inference.py produces structured tags correctly with baseline scores.") | |
| print(stdout) | |
| else: | |
| print("[FAIL] inference.py output is missing structured tags.") | |
| print(f"Stdout summary: {stdout[:500]}") | |
| all_ok = False | |
| except Exception as e: | |
| print(f"[FAIL] inference.py crashed: {e}") | |
| all_ok = False | |
| print("\n" + "=" * 50) | |
| if all_ok: | |
| print("RESULT: ALL CHECKS PASSED. Ready for HF Spaces.") | |
| else: | |
| print("RESULT: CHECKS FAILED. Fix issues before deployment.") | |
| print("=" * 50) | |