A minimalist playground for the laya-mlx typed decision model (aac6fef/laya-mlx). Backed by FastAPI.
- Apple Silicon Mac
- Python 3.11+
cd playground
python3.11 -m venv venv
source venv/bin/activate
pip install -r requirements.txtuvicorn main:app --reloadThen open http://127.0.0.1:8777.
The model downloads once on first run (~800MB from Hugging Face) and then stays resident in memory for the life of the process.
| File | Purpose |
|---|---|
main.py |
FastAPI app. Loads the model at startup, exposes GET /api/scenarios and POST /api/predict. |
index.html |
The playground UI — scenario picker, state text, questions editor, results panel. |
scenarios.json |
The predefined scenarios shown in the dropdown. Edit or add entries here; no code changes needed. |
- Pick a scenario from the dropdown (left panel), or write your own
state_textand a questions tree (middle panel) from scratch. - Click Run prediction.
- The right panel shows the latency, each question's answer with probability bars, and a Raw JSON tab with the exact API response.
{
"department": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": ["billing", "technical", "sales"]
},
"urgency": {
"type": "score",
"instructions": "How urgent is this?",
"criteria": ["Low", "Normal", "High", "Critical"]
},
"refund_requested": {
"type": "noul",
"instructions": "Does the customer ask for money back?"
}
}choice— probabilities over the listed options.score— probabilities over ordered rubric levels, plus an expected score.noul— P(true) for the stated proposition; nocriterianeeded.
Append an object to scenarios.json:
{
"id": "unique_id",
"label": "Shown in the dropdown",
"state_text": "...",
"questions": { ... }
}No restart required beyond the usual --reload behavior.
MIT
