CoolFace
Apppublic

OYZZ/patch-antenna-strategy-workbench

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
App README

Public App

This directory turns the offline patch-antenna scripts into a public-facing app:

  • backend/: FastAPI inference API
  • frontend/: Next.js workbench UI
  • backend/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

  1. 1.Create a new Space on Hugging Face.
  2. 2.Choose Docker as the SDK.
  3. 3.Prepare a clean upload directory:
powershell
powershell -ExecutionPolicy Bypass -File .\scripts\prepare_hf_space.ps1
  1. 1.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
  2. 2.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:

powershell
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 main

Note:

  • backend/artifacts/inference_bundle.joblib is 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:

powershell
py -3 .\scripts\export_public_inference_bundle.py

This 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:

powershell
py -3 -m pip install -r .\requirements.txt
py -3 -m uvicorn app.main:app --host 127.0.0.1 --port 8000

Optional environment variable:

powershell
$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:

powershell
npm install
npm run dev

For the single-port deployment shape used by Hugging Face Spaces:

powershell
$env:NEXT_OUTPUT_EXPORT = 'true'
npm run build
py -3 -m uvicorn backend.app.main:app --host 127.0.0.1 --port 7860

Optional environment variable:

powershell
$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
powershell -ExecutionPolicy Bypass -File .\scripts\prepare_hf_space.ps1
powershell -ExecutionPolicy Bypass -File .\scripts\test_local_docker.ps1

Make 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:

powershell
docker rm -f patch-antenna-space-local-container

Key Endpoints

  • GET /health
  • GET /options
  • POST /rank-routes
  • POST /predict-route