Spaces:
Sleeping
Sleeping
| # start_gesture.py | |
| # βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # CLOUD mode entry point for HuggingFace Spaces (supervisord). | |
| # | |
| # ARCHITECTURE (single process): | |
| # 1. Creates SharedState (stdlib queue β no Manager, no IPC) | |
| # 2. Passes it to dashboard_process() | |
| # 3. dashboard_process() assigns it to _shared_state module global | |
| # AND starts core_processing_engine() as a daemon thread | |
| # 4. on_browser_frame() writes to _shared_state via put_frame() | |
| # 5. core_processing_engine() reads via take_frame() | |
| # | |
| # β KEY: SharedState is created ONCE here and passed all the way through. | |
| # There is no second SharedState anywhere β same object, same queue. | |
| # βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| import os | |
| import sys | |
| import time | |
| os.environ["RUN_MODE"] = "CLOUD" | |
| os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" | |
| os.environ["CUDA_VISIBLE_DEVICES"] = "-1" | |
| os.environ["PYTHONUNBUFFERED"] = "1" | |
| print("=" * 60, flush=True) | |
| print("π ISL Gesture Dashboard starting (CLOUD mode)β¦", flush=True) | |
| print("=" * 60, flush=True) | |
| # ββ Import SharedState ββββββββββββββββββββββββββββββββββββββββ | |
| try: | |
| from isl_detection import SharedState | |
| print("β SharedState imported", flush=True) | |
| except Exception as e: | |
| print(f"β IMPORT ERROR (SharedState): {e}", flush=True) | |
| import traceback; traceback.print_exc() | |
| sys.exit(1) | |
| # ββ Import dashboard_process ββββββββββββββββββββββββββββββββββ | |
| try: | |
| from isl_ui_dashboard import dashboard_process | |
| print("β dashboard_process imported", flush=True) | |
| except Exception as e: | |
| print(f"β IMPORT ERROR (dashboard_process): {e}", flush=True) | |
| import traceback; traceback.print_exc() | |
| sys.exit(1) | |
| # ββ Create SharedState (single instance) βββββββββββββββββββββ | |
| try: | |
| shared_state = SharedState() | |
| print("β SharedState created (queue.Queue β no IPC)", flush=True) | |
| except Exception as e: | |
| print(f"β SharedState init error: {e}", flush=True) | |
| import traceback; traceback.print_exc() | |
| sys.exit(1) | |
| # ββ Launch ββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| print("π Calling dashboard_process (port 5000)β¦", flush=True) | |
| try: | |
| dashboard_process( | |
| shared_state=shared_state, | |
| shm_name=None, | |
| frame_lock_val=None, | |
| frame_seq=None, | |
| ) | |
| except Exception as e: | |
| print(f"β dashboard_process CRASHED: {e}", flush=True) | |
| import traceback; traceback.print_exc() | |
| sys.exit(1) |