title: Token Hold'em colorFrom: red colorTo: amber sdk: gradio sdk_version: 6.18.0 app_file: app.py pinned: false tags:
Token Hold'em is a Thousand Token Wood Gradio poker tavern for the Hugging Face Build Small Hackathon. One human can quick-seat into a Texas Hold'em cash game against seven LLM poker agents, or judges can run an AI Arena where the model seats play hands against each other.
The poker engine is deterministic: it owns dealing, blinds, legal actions, betting, showdown, side-pot settlement, chip movement, leaderboard records, and Hall of Fame stats. Models only choose among legal actions and generate short table talk.
uv sync
uv run python app.py
Open the printed Gradio URL, usually http://127.0.0.1:7860/.
For production-style model play through Modal:
USE_MODAL_INFERENCE=true uv run python app.py
For local development only, deterministic bots can be enabled explicitly:
TOKEN_HOLDEM_ALLOW_DETERMINISTIC_BOTS=1 uv run python app.py
That fallback mode is intentionally labeled as development/test behavior. Normal model-enabled play does not silently replace unavailable LLMs with bots.
Modal is the runtime boundary for LLM poker decisions. The local Gradio process sends a serializable game-state summary, the acting model name, model id, persona, legal actions, and the decision prompt to modal_inference.py::run_agent_decision.
Modal returns:
actionbet_amountexplanationcommentaryraw_model_outputerrorIf Modal lookup, timeout, model loading, generation, or response validation fails, the app logs the failure and surfaces a clear model-unavailable message. It does not apply a fake fallback action.
Deploy Modal:
uv run modal deploy modal_inference.py
Smoke-test one seat:
uv run modal run modal_inference.py::smoke --model-name Gemma
USE_MODAL_INFERENCE=true: use Modal for model decisions.TOKEN_HOLDEM_MODAL_APP_NAME: Modal app name. Default: token-holdem-inference.TOKEN_HOLDEM_MODAL_MODEL_NAMES: comma-separated player/model names, or all. Default: all.TOKEN_HOLDEM_MODAL_HF_SECRET_NAME: Modal secret exposing HF_TOKEN. Default: token-holdem-hf-token.TOKEN_HOLDEM_MODAL_TIMEOUT_SECONDS: local wait timeout for a Modal call. Default: 300.TOKEN_HOLDEM_MODAL_GPU: Modal GPU type. Default: L40S.TOKEN_HOLDEM_GGUF_CONTEXT: llama.cpp context for GGUF Modal seats. Default: 4096.TOKEN_HOLDEM_GGUF_GPU_LAYERS: llama.cpp GPU layer count. Default: -1.TOKEN_HOLDEM_ALLOW_MODEL_DOWNLOADS=1: allow local Transformers downloads for local-runtime experiments.TOKEN_HOLDEM_ALLOW_DETERMINISTIC_BOTS=1: explicit development/test fallback mode.Create the Modal HF secret:
uv run modal secret create token-holdem-hf-token --from-dotenv .env --force
All configured models are under the 32B hackathon cap. Live Hub metadata was checked during finalization on 2026-06-15.
| Seat | Model | Parameters / format | Runtime status |
|---|---|---|---|
| Nemotron Nano | nvidia/NVIDIA-Nemotron-3-Nano-4B-GGUF | 3.97B GGUF | Active through Modal llama.cpp |
| Qwen | lm-kit/qwen-3-0.6b-instruct-gguf | 0.75B GGUF | Active through Modal llama.cpp |
| Gemma | google/gemma-4-12B-it | 11.96B safetensors | Active through Modal Transformers |
| Cohere North Mini | CohereLabs/North-Mini-Code-1.0 | 30.48B safetensors | Active through Modal Transformers |
| Mistral | TheBloke/Mistral-7B-Instruct-v0.2-GGUF | 7.24B GGUF | Active through Modal llama.cpp |
| OpenAI Open Model 20B | openai/gpt-oss-20b | 21.51B mixed precision | Active through Modal Transformers |
| Llama Scout | meta-llama/Llama-3.2-1B-Instruct | 1.24B safetensors | Active through Modal if the HF token has gated access |
The Diagnostics tab shows recent runtime evidence for each seat: model called, Modal/local source, action returned, and any unavailable/disabled reason.
Human Quick Play:
Quick Seat.Next Hand continues the cash-game session with current stacks and rotating button.Rebuy 1000 appears if the human busts.AI Arena:
AI Arena.Start Arena.uv run pytest
Root tests cover poker flow, app sessions, leaderboard persistence, logging, model-runtime parsing/status behavior, and stable eight-seat rendering. The ml-intern/ checkout is reference/tooling only and is intentionally excluded from root app checks.
nvidia/NVIDIA-Nemotron-3-Nano-4B-GGUF as an active Modal GGUF seat. Note for judges: Nemotron Nano is one of the table agents.Play Mode, click Quick Seat, and play at least one human action.Diagnostics, click Refresh Recent Logs, and verify Modal model-call rows.AI Arena for one hand.Leaderboard and Hall of Fame to see recorded outcomes.Demo video placeholder: TODO: add demo video URL
Social post placeholder: TODO: add social post URL
app.py: Gradio app, callbacks, diagnostics, and mode wiring.modal_inference.py: Modal GPU/llama.cpp/Transformers inference function.token_holdem/engine.py: deterministic poker state machine.token_holdem/agents.py: roster and explicit development fallback personalities.token_holdem/model_runtime.py: runtime selection, Modal adapter, validation, status reporting, and no-silent-fallback policy.token_holdem/render.py: HTML/CSS poker table rendering.token_holdem/leaderboard.py: SQLite stats and Hall of Fame.assets/token-holdem/manifest.json: local asset manifest.8 commits
title: Token Hold'em colorFrom: red colorTo: amber sdk: gradio sdk_version: 6.18.0 app_file: app.py pinned: false tags:
Token Hold'em is a Thousand Token Wood Gradio poker tavern for the Hugging Face Build Small Hackathon. One human can quick-seat into a Texas Hold'em cash game against seven LLM poker agents, or judges can run an AI Arena where the model seats play hands against each other.
The poker engine is deterministic: it owns dealing, blinds, legal actions, betting, showdown, side-pot settlement, chip movement, leaderboard records, and Hall of Fame stats. Models only choose among legal actions and generate short table talk.
uv sync
uv run python app.py
Open the printed Gradio URL, usually http://127.0.0.1:7860/.
For production-style model play through Modal:
USE_MODAL_INFERENCE=true uv run python app.py
For local development only, deterministic bots can be enabled explicitly:
TOKEN_HOLDEM_ALLOW_DETERMINISTIC_BOTS=1 uv run python app.py
That fallback mode is intentionally labeled as development/test behavior. Normal model-enabled play does not silently replace unavailable LLMs with bots.
Modal is the runtime boundary for LLM poker decisions. The local Gradio process sends a serializable game-state summary, the acting model name, model id, persona, legal actions, and the decision prompt to modal_inference.py::run_agent_decision.
Modal returns:
actionbet_amountexplanationcommentaryraw_model_outputerrorIf Modal lookup, timeout, model loading, generation, or response validation fails, the app logs the failure and surfaces a clear model-unavailable message. It does not apply a fake fallback action.
Deploy Modal:
uv run modal deploy modal_inference.py
Smoke-test one seat:
uv run modal run modal_inference.py::smoke --model-name Gemma
USE_MODAL_INFERENCE=true: use Modal for model decisions.TOKEN_HOLDEM_MODAL_APP_NAME: Modal app name. Default: token-holdem-inference.TOKEN_HOLDEM_MODAL_MODEL_NAMES: comma-separated player/model names, or all. Default: all.TOKEN_HOLDEM_MODAL_HF_SECRET_NAME: Modal secret exposing HF_TOKEN. Default: token-holdem-hf-token.TOKEN_HOLDEM_MODAL_TIMEOUT_SECONDS: local wait timeout for a Modal call. Default: 300.TOKEN_HOLDEM_MODAL_GPU: Modal GPU type. Default: L40S.TOKEN_HOLDEM_GGUF_CONTEXT: llama.cpp context for GGUF Modal seats. Default: 4096.TOKEN_HOLDEM_GGUF_GPU_LAYERS: llama.cpp GPU layer count. Default: -1.TOKEN_HOLDEM_ALLOW_MODEL_DOWNLOADS=1: allow local Transformers downloads for local-runtime experiments.TOKEN_HOLDEM_ALLOW_DETERMINISTIC_BOTS=1: explicit development/test fallback mode.Create the Modal HF secret:
uv run modal secret create token-holdem-hf-token --from-dotenv .env --force
All configured models are under the 32B hackathon cap. Live Hub metadata was checked during finalization on 2026-06-15.
| Seat | Model | Parameters / format | Runtime status |
|---|---|---|---|
| Nemotron Nano | nvidia/NVIDIA-Nemotron-3-Nano-4B-GGUF | 3.97B GGUF | Active through Modal llama.cpp |
| Qwen | lm-kit/qwen-3-0.6b-instruct-gguf | 0.75B GGUF | Active through Modal llama.cpp |
| Gemma | google/gemma-4-12B-it | 11.96B safetensors | Active through Modal Transformers |
| Cohere North Mini | CohereLabs/North-Mini-Code-1.0 | 30.48B safetensors | Active through Modal Transformers |
| Mistral | TheBloke/Mistral-7B-Instruct-v0.2-GGUF | 7.24B GGUF | Active through Modal llama.cpp |
| OpenAI Open Model 20B | openai/gpt-oss-20b | 21.51B mixed precision | Active through Modal Transformers |
| Llama Scout | meta-llama/Llama-3.2-1B-Instruct | 1.24B safetensors | Active through Modal if the HF token has gated access |
The Diagnostics tab shows recent runtime evidence for each seat: model called, Modal/local source, action returned, and any unavailable/disabled reason.
Human Quick Play:
Quick Seat.Next Hand continues the cash-game session with current stacks and rotating button.Rebuy 1000 appears if the human busts.AI Arena:
AI Arena.Start Arena.uv run pytest
Root tests cover poker flow, app sessions, leaderboard persistence, logging, model-runtime parsing/status behavior, and stable eight-seat rendering. The ml-intern/ checkout is reference/tooling only and is intentionally excluded from root app checks.
nvidia/NVIDIA-Nemotron-3-Nano-4B-GGUF as an active Modal GGUF seat. Note for judges: Nemotron Nano is one of the table agents.Play Mode, click Quick Seat, and play at least one human action.Diagnostics, click Refresh Recent Logs, and verify Modal model-call rows.AI Arena for one hand.Leaderboard and Hall of Fame to see recorded outcomes.Demo video placeholder: TODO: add demo video URL
Social post placeholder: TODO: add social post URL
app.py: Gradio app, callbacks, diagnostics, and mode wiring.modal_inference.py: Modal GPU/llama.cpp/Transformers inference function.token_holdem/engine.py: deterministic poker state machine.token_holdem/agents.py: roster and explicit development fallback personalities.token_holdem/model_runtime.py: runtime selection, Modal adapter, validation, status reporting, and no-silent-fallback policy.token_holdem/render.py: HTML/CSS poker table rendering.token_holdem/leaderboard.py: SQLite stats and Hall of Fame.assets/token-holdem/manifest.json: local asset manifest.8 commits
Python
96.1%
Shell
3.7%