UbiOne Camera Vitals local service
==================================

Purpose
-------
This package runs the local Python relay used by the Cloudflare demo:

https://ubione-avatar-demo.pages.dev/health-basic/

The web page runs on Cloudflare Pages. The camera-vitals service runs on this
computer at:

http://127.0.0.1:8791

If port 8791 is blocked by the system or another app, the relay will automatically
try ports 8792, 8793, 8794, and 8795. The Cloudflare page can detect these ports.

How to use on macOS
-------------------
1. Unzip this package.
2. Open Terminal.
3. Go to the unzipped folder. Example:

   cd ~/Downloads/ubione-health-vitals-local

4. The first time only, allow the launcher script to run:

   chmod +x start-health-vitals-local.sh

5. Start the local relay:

   ./start-health-vitals-local.sh

6. Keep the Terminal window open while using the demo. If you close this
   Terminal window, the local relay stops and the Cloudflare page cannot read
   the latest vitals.
7. Open the Cloudflare demo page in Chrome:

   https://ubione-avatar-demo.pages.dev/health-basic/

8. Open the left menu, open "Camera Vitals", and allow camera access in Chrome.

After restarting the Mac
------------------------
Open Terminal, go back to the unzipped folder, and run:

   ./start-health-vitals-local.sh

You do not need to install pip packages for the current demo relay.

Running in the background on macOS
----------------------------------
If you want to close the Terminal window after starting the relay, run this
from the unzipped folder instead:

   nohup ./start-health-vitals-local.sh > ubione-vitals.log 2>&1 &

The relay will keep running in the background. To stop it later, use Activity
Monitor to quit the Python process, or run:

   pkill -f vitals-service/local_server.py

Optional health check
---------------------
When the relay is running, this URL should return JSON:

   http://127.0.0.1:8791/api/health

If the relay used another port, try 8792, 8793, 8794, or 8795.

How to use on Windows
---------------------
1. Unzip this package.
2. Double-click:

   start-health-vitals-local.cmd

3. Keep the command window open.
4. Open the Cloudflare demo page:

   https://ubione-avatar-demo.pages.dev/health-basic/

5. Open the left menu, open "Camera Vitals", and allow camera access in Chrome.

What is included
----------------
- vitals-service/local_server.py
- vitals-service/requirements.txt
- start-health-vitals-local.cmd
- start-health-vitals-local.sh

Current engine
--------------
This package does not install pip dependencies. The browser computes the demo
vitals with a lightweight CHROM rPPG signal path, and the local Python relay
exposes the latest value on the first available port from 8791 to 8795.
This avoids Python 3.14 / Pillow / compiler issues on Windows demo machines.

For stronger production inference, the browser rPPG path can later be compared
against or replaced with open-rppg / VitalLens, depending on privacy, runtime,
and validation requirements.

Safety wording
--------------
Treat values as camera-estimated wellness trends only. Do not use this as a
medical device or diagnostic tool.
