OYZZ/patch-antenna-strategy-workbench
Public App
This directory turns the offline patch-antenna scripts into a public-facing app:
backend/: FastAPI inference APIfrontend/: Next.js workbench UIbackend/artifacts/inference_bundle.joblib: deployment-time model bundle
What It Does
The public surface is framed as a review-level strategy workbench:
- rank candidate topology routes for a target scenario
- estimate continuous forward metrics
- inspect one manually selected route
It is not presented as a final geometry design generator.
Hugging Face Spaces
- Create a new Space on Hugging Face.
- Choose
Dockeras the SDK. - Prepare a clean upload directory:
powershell -ExecutionPolicy Bypass -File .\scripts\prepare_hf_space.ps1- Use the prepared stage directory as the Space repository root. Default path:
D:\patch_review_recovery_20260416\patch-antenna-model-training\public_app_deploy_stage - Push that directory to the Space repo over Git.
Hugging Face will build the container from Dockerfile and expose the app on port 7860.
Example Git flow from the prepared stage directory:
hf auth login
cd D:\patch_review_recovery_20260416\patch-antenna-model-training\public_app_deploy_stage
git init
git checkout -b main
git lfs install
git add .
git commit -m "Initial Space app"
git remote add origin https://huggingface.co/spaces/<YOUR_USERNAME>/<SPACE_NAME>
git push origin mainNote:
backend/artifacts/inference_bundle.joblibis larger than 10 MB, so it is tracked with Git LFS via.gitattributes.
Local Backend Bundle Refresh
From D:\patch_review_recovery_20260416\patch-antenna-model-training:
py -3 .\scripts\export_public_inference_bundle.pyThis refreshes backend/artifacts/inference_bundle.joblib, which should be committed into the Space repo for deployment.
Local Run
From D:\patch_review_recovery_20260416\patch-antenna-model-training\public_app\backend:
py -3 -m pip install -r .\requirements.txt
py -3 -m uvicorn app.main:app --host 127.0.0.1 --port 8000Optional environment variable:
$env:PATCH_PUBLIC_BUNDLE = 'D:\patch_review_recovery_20260416\patch-antenna-model-training\public_app\backend\artifacts\inference_bundle.joblib'Frontend
From D:\patch_review_recovery_20260416\patch-antenna-model-training\public_app\frontend:
npm install
npm run devFor the single-port deployment shape used by Hugging Face Spaces:
$env:NEXT_OUTPUT_EXPORT = 'true'
npm run build
py -3 -m uvicorn backend.app.main:app --host 127.0.0.1 --port 7860Optional environment variable:
$env:NEXT_PUBLIC_API_BASE_URL = ''Local Docker Self-Test
After preparing the deploy stage, build and run the same container shape that Hugging Face Spaces will use:
powershell -ExecutionPolicy Bypass -File .\scripts\prepare_hf_space.ps1
powershell -ExecutionPolicy Bypass -File .\scripts\test_local_docker.ps1Make sure Docker Desktop is running first, with Linux containers enabled.
This will:
- build the Docker image from
public_app_deploy_stage - start it on
http://127.0.0.1:7860 - verify
/and/options
Stop the local test container later with:
docker rm -f patch-antenna-space-local-containerKey Endpoints
GET /healthGET /optionsPOST /rank-routesPOST /predict-route
