# HWS AI Customer Demo Service

This folder is the local AI service used by `ai_video_inspector_demo`.

It supports two demo modes with one service process:

1. `YOLO Objects` - video object detection.
2. `ASR EN->CN` - English speech recognition + Chinese text translation. C++ demo can use Windows SAPI for ordinary voice playback.

The service exposes:

- HTTP: `http://127.0.0.1:8765`
- WebSocket: `ws://127.0.0.1:8766/v1/ai/stream`

## Clean startup design

`start_ai_service_customer_demo.bat` does **not** download models from the internet.
It only loads local model folders:

- `models\faster-whisper-base`
- `models\opus-mt-en-zh`

This avoids long startup waits and avoids startup failure caused by network timeout.

## First-time setup on a networked PC

Run these once:

```bat
setup_ai_env.bat
install_customer_demo_deps.bat
download_customer_demo_models.bat
```

`download_customer_demo_models.bat` downloads and caches:

- `Systran/faster-whisper-base`
- `Helsinki-NLP/opus-mt-en-zh`

After this step, you can run the demo offline.

## Normal demo startup

```bat
start_ai_service_customer_demo.bat
```

Then run `ai_video_inspector_demo.exe`.

Use the UI mode selector:

- `YOLO Objects`: supports WS or HTTP transport.
- `ASR EN->CN`: uses WS transport.
- `Shared Memory`: reserved for future video transport.

Do not run multiple AI services at the same time because they use the same ports.

## ai_service files kept intentionally

- `local_ai_service.py` - local HTTP/WS AI service.
- `yolo11n.pt` - local YOLO model file.
- `setup_ai_env.bat` - create Python venv.
- `install_customer_demo_deps.bat` - install Python packages.
- `download_customer_demo_models.bat` - one-time online model cache.
- `download_customer_demo_models.py` - model cache helper.
- `start_ai_service_customer_demo.bat` - offline/local-model service startup.
- `requirements_customer_demo.txt` - dependencies.

No Edge TTS / MP3 / extra test scripts are required in this customer demo package.
