Spaces:
Running
Running
Download chess_emotions_app/main.py from NatashaN/chess_emotions_app: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/spaces/NatashaN/chess_emotions_app/resolve/main/chess_emotions_app/main.py
- Command line
-
hf download hf://spaces/NatashaN/chess_emotions_app/chess_emotions_app/main.py
-
curl -L -o main.py https://huggingface.co/spaces/NatashaN/chess_emotions_app/resolve/main/chess_emotions_app/main.py
1.04 kB
| """Chess Emotions App - Play chess vs Stockfish while Reachy reacts! | |
| Reachy roots for Stockfish, so expect celebrations when you blunder | |
| and worried looks when you play well. | |
| All chess logic runs in the browser (chess.js + stockfish.js WASM). | |
| Emotions are triggered via direct REST calls to the Reachy daemon. | |
| """ | |
| import threading | |
| from reachy_mini import ReachyMini, ReachyMiniApp | |
| import time | |
| class ChessEmotionsApp(ReachyMiniApp): | |
| # Web UI served at this port | |
| custom_app_url: str | None = "http://0.0.0.0:8042" | |
| # No special media backend needed | |
| request_media_backend: str | None = None | |
| def run(self, reachy_mini: ReachyMini, stop_event: threading.Event): | |
| # The app is entirely web-based - just keep the daemon alive | |
| # Emotions are triggered by the browser via REST API calls to port 8000 | |
| while not stop_event.is_set(): | |
| time.sleep(0.1) | |
| if __name__ == "__main__": | |
| app = ChessEmotionsApp() | |
| try: | |
| app.wrapped_run() | |
| except KeyboardInterrupt: | |
| app.stop() | |