Update app.py
Browse files
app.py
CHANGED
|
@@ -4,9 +4,7 @@ Persistent woodland civilisation simulation powered by Qwen2.5-1.5B.
|
|
| 4 |
Build Small Hackathon 2026 — Thousand Token Wood track.
|
| 5 |
Model: Qwen/Qwen2.5-1.5B-Instruct (≤4B → Tiny Titan badge!)
|
| 6 |
"""
|
| 7 |
-
|
| 8 |
-
# 0 ▸ IMPORTS
|
| 9 |
-
# ═══════════════════════════════════════════════════════════════════
|
| 10 |
from __future__ import annotations
|
| 11 |
import json, os, random, textwrap, traceback, re
|
| 12 |
from datetime import datetime
|
|
@@ -135,304 +133,7 @@ NARRATOR_PROMPT = (
|
|
| 135 |
"MOLE: One cryptic sentence."
|
| 136 |
)
|
| 137 |
|
| 138 |
-
|
| 139 |
-
# 3 ▸ INFERENCE BACKEND
|
| 140 |
-
# ─
|
| 141 |
-
# 3 ▸ INFERENCE BACKEND
|
| 142 |
-
# ─
|
| 143 |
-
# 3 ▸ INFERENCE BACKEND
|
| 144 |
-
# ─
|
| 145 |
-
# 3 ▸ INFERENCE BACKEND
|
| 146 |
-
# ─
|
| 147 |
-
# 3 ▸ INFERENCE BACKEND
|
| 148 |
-
# ─
|
| 149 |
-
# 3 ▸ INFERENCE BACKEND
|
| 150 |
-
# ─
|
| 151 |
-
# 3 ▸ INFERENCE BACKEND
|
| 152 |
-
# ─
|
| 153 |
-
# 3 ▸ INFERENCE BACKEND
|
| 154 |
-
# ─
|
| 155 |
-
# 3 ▸ INFERENCE BACKEND
|
| 156 |
-
# ─
|
| 157 |
-
# 3 ▸ INFERENCE BACKEND
|
| 158 |
-
# ─
|
| 159 |
-
# 3 ▸ INFERENCE BACKEND
|
| 160 |
-
# ─
|
| 161 |
-
# 3 ▸ INFERENCE BACKEND
|
| 162 |
-
# ─
|
| 163 |
-
# 3 ▸ INFERENCE BACKEND
|
| 164 |
-
# ─
|
| 165 |
-
# 3 ▸ INFERENCE BACKEND
|
| 166 |
-
# ─
|
| 167 |
-
# 3 ▸ INFERENCE BACKEND
|
| 168 |
-
# ─
|
| 169 |
-
# 3 ▸ INFERENCE BACKEND
|
| 170 |
-
# ─
|
| 171 |
-
# 3 ▸ INFERENCE BACKEND
|
| 172 |
-
# ─
|
| 173 |
-
# 3 ▸ INFERENCE BACKEND
|
| 174 |
-
# ─
|
| 175 |
-
# 3 ▸ INFERENCE BACKEND
|
| 176 |
-
# ─
|
| 177 |
-
# 3 ▸ INFERENCE BACKEND
|
| 178 |
-
# ─
|
| 179 |
-
# 3 ▸ INFERENCE BACKEND
|
| 180 |
-
# ─
|
| 181 |
-
# 3 ▸ INFERENCE BACKEND
|
| 182 |
-
# ─
|
| 183 |
-
# 3 ▸ INFERENCE BACKEND
|
| 184 |
-
# ─
|
| 185 |
-
# 3 ▸ INFERENCE BACKEND
|
| 186 |
-
# ─
|
| 187 |
-
# 3 ▸ INFERENCE BACKEND
|
| 188 |
-
# ─
|
| 189 |
-
# 3 ▸ INFERENCE BACKEND
|
| 190 |
-
# ─
|
| 191 |
-
# 3 ▸ INFERENCE BACKEND
|
| 192 |
-
# ─
|
| 193 |
-
# 3 ▸ INFERENCE BACKEND
|
| 194 |
-
# ─
|
| 195 |
-
# 3 ▸ INFERENCE BACKEND
|
| 196 |
-
# ─
|
| 197 |
-
# 3 ▸ INFERENCE BACKEND
|
| 198 |
-
# ─
|
| 199 |
-
# 3 ▸ INFERENCE BACKEND
|
| 200 |
-
# ─
|
| 201 |
-
# 3 ▸ INFERENCE BACKEND
|
| 202 |
-
# ─
|
| 203 |
-
# 3 ▸ INFERENCE BACKEND
|
| 204 |
-
# ─
|
| 205 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 206 |
-
#
|
| 207 |
-
# INSTANT FIX for quota errors:
|
| 208 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 209 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 210 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 211 |
-
# ═
|
| 212 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 213 |
-
#
|
| 214 |
-
# INSTANT FIX for quota errors:
|
| 215 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 216 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 217 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 218 |
-
# ═
|
| 219 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 220 |
-
#
|
| 221 |
-
# INSTANT FIX for quota errors:
|
| 222 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 223 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 224 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 225 |
-
# ═
|
| 226 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 227 |
-
#
|
| 228 |
-
# INSTANT FIX for quota errors:
|
| 229 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 230 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 231 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 232 |
-
# ═
|
| 233 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 234 |
-
#
|
| 235 |
-
# INSTANT FIX for quota errors:
|
| 236 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 237 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 238 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 239 |
-
# ═
|
| 240 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 241 |
-
#
|
| 242 |
-
# INSTANT FIX for quota errors:
|
| 243 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 244 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 245 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 246 |
-
# ═
|
| 247 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 248 |
-
#
|
| 249 |
-
# INSTANT FIX for quota errors:
|
| 250 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 251 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 252 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 253 |
-
# ═
|
| 254 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 255 |
-
#
|
| 256 |
-
# INSTANT FIX for quota errors:
|
| 257 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 258 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 259 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 260 |
-
# ═
|
| 261 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 262 |
-
#
|
| 263 |
-
# INSTANT FIX for quota errors:
|
| 264 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 265 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 266 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 267 |
-
# ═
|
| 268 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 269 |
-
#
|
| 270 |
-
# INSTANT FIX for quota errors:
|
| 271 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 272 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 273 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 274 |
-
# ═
|
| 275 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 276 |
-
#
|
| 277 |
-
# INSTANT FIX for quota errors:
|
| 278 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 279 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 280 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 281 |
-
# ═
|
| 282 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 283 |
-
#
|
| 284 |
-
# INSTANT FIX for quota errors:
|
| 285 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 286 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 287 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 288 |
-
# ═
|
| 289 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 290 |
-
#
|
| 291 |
-
# INSTANT FIX for quota errors:
|
| 292 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 293 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 294 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 295 |
-
# ═
|
| 296 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 297 |
-
#
|
| 298 |
-
# INSTANT FIX for quota errors:
|
| 299 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 300 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 301 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 302 |
-
# ═
|
| 303 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 304 |
-
#
|
| 305 |
-
# INSTANT FIX for quota errors:
|
| 306 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 307 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 308 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 309 |
-
# ═
|
| 310 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 311 |
-
#
|
| 312 |
-
# INSTANT FIX for quota errors:
|
| 313 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 314 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 315 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 316 |
-
# ═
|
| 317 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 318 |
-
#
|
| 319 |
-
# INSTANT FIX for quota errors:
|
| 320 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 321 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 322 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 323 |
-
# ═
|
| 324 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 325 |
-
#
|
| 326 |
-
# INSTANT FIX for quota errors:
|
| 327 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 328 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 329 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 330 |
-
# ═
|
| 331 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 332 |
-
#
|
| 333 |
-
# INSTANT FIX for quota errors:
|
| 334 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 335 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 336 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 337 |
-
# ═
|
| 338 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 339 |
-
#
|
| 340 |
-
# INSTANT FIX for quota errors:
|
| 341 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 342 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 343 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 344 |
-
# ═
|
| 345 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 346 |
-
#
|
| 347 |
-
# INSTANT FIX for quota errors:
|
| 348 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 349 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 350 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 351 |
-
# ═
|
| 352 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 353 |
-
#
|
| 354 |
-
# INSTANT FIX for quota errors:
|
| 355 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 356 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 357 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 358 |
-
# ═
|
| 359 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 360 |
-
#
|
| 361 |
-
# INSTANT FIX for quota errors:
|
| 362 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 363 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 364 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 365 |
-
# ═
|
| 366 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 367 |
-
#
|
| 368 |
-
# INSTANT FIX for quota errors:
|
| 369 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 370 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 371 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 372 |
-
# ═
|
| 373 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 374 |
-
#
|
| 375 |
-
# INSTANT FIX for quota errors:
|
| 376 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 377 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 378 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 379 |
-
# ═
|
| 380 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 381 |
-
#
|
| 382 |
-
# INSTANT FIX for quota errors:
|
| 383 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 384 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 385 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 386 |
-
# ═
|
| 387 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 388 |
-
#
|
| 389 |
-
# INSTANT FIX for quota errors:
|
| 390 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 391 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 392 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 393 |
-
# ═
|
| 394 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 395 |
-
#
|
| 396 |
-
# INSTANT FIX for quota errors:
|
| 397 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 398 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 399 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 400 |
-
# ═
|
| 401 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 402 |
-
#
|
| 403 |
-
# INSTANT FIX for quota errors:
|
| 404 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 405 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 406 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 407 |
-
# ═
|
| 408 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 409 |
-
#
|
| 410 |
-
# INSTANT FIX for quota errors:
|
| 411 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 412 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 413 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 414 |
-
# ═
|
| 415 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 416 |
-
#
|
| 417 |
-
# INSTANT FIX for quota errors:
|
| 418 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 419 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 420 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 421 |
-
# ═
|
| 422 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 423 |
-
#
|
| 424 |
-
# INSTANT FIX for quota errors:
|
| 425 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 426 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 427 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 428 |
-
# ═
|
| 429 |
-
# Priority: HF API → Modal → Local ZeroGPU
|
| 430 |
-
#
|
| 431 |
-
# INSTANT FIX for quota errors:
|
| 432 |
-
# Space Settings → Variables & Secrets → New Secret
|
| 433 |
-
# Name: HF_TOKEN Value: hf_xxxx (huggingface.co/settings/tokens)
|
| 434 |
-
# This switches to HF serverless inference — zero ZeroGPU quota consumed.
|
| 435 |
-
# ═
|
| 436 |
import os as _os
|
| 437 |
import requests as _req
|
| 438 |
from huggingface_hub import InferenceClient as _InfClient
|
|
@@ -694,139 +395,7 @@ def _run_simulation_step(nudge_type, nudge_value, nudge_target):
|
|
| 694 |
return day_number, parsed, classified
|
| 695 |
|
| 696 |
|
| 697 |
-
|
| 698 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 699 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 700 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 701 |
-
# ═
|
| 702 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 703 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 704 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 705 |
-
# ═
|
| 706 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 707 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 708 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 709 |
-
# ═
|
| 710 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 711 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 712 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 713 |
-
# ═
|
| 714 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 715 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 716 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 717 |
-
# ═
|
| 718 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 719 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 720 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 721 |
-
# ═
|
| 722 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 723 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 724 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 725 |
-
# ═
|
| 726 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 727 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 728 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 729 |
-
# ═
|
| 730 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 731 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 732 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 733 |
-
# ═
|
| 734 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 735 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 736 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 737 |
-
# ═
|
| 738 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 739 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 740 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 741 |
-
# ═
|
| 742 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 743 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 744 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 745 |
-
# ═
|
| 746 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 747 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 748 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 749 |
-
# ═
|
| 750 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 751 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 752 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 753 |
-
# ═
|
| 754 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 755 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 756 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 757 |
-
# ═
|
| 758 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 759 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 760 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 761 |
-
# ═
|
| 762 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 763 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 764 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 765 |
-
# ═
|
| 766 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 767 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 768 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 769 |
-
# ═
|
| 770 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 771 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 772 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 773 |
-
# ═
|
| 774 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 775 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 776 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 777 |
-
# ═
|
| 778 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 779 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 780 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 781 |
-
# ═
|
| 782 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 783 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 784 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 785 |
-
# ═
|
| 786 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 787 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 788 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 789 |
-
# ═
|
| 790 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 791 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 792 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 793 |
-
# ═
|
| 794 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 795 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 796 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 797 |
-
# ═
|
| 798 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 799 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 800 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 801 |
-
# ═
|
| 802 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 803 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 804 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 805 |
-
# ═
|
| 806 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 807 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 808 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 809 |
-
# ═
|
| 810 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 811 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 812 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 813 |
-
# ═
|
| 814 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 815 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 816 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 817 |
-
# ═
|
| 818 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 819 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 820 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 821 |
-
# ═
|
| 822 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 823 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 824 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 825 |
-
# ═
|
| 826 |
-
# 5 ▸ ADVANCE DAY (GPU-decorated only if local backend active)
|
| 827 |
-
# ZeroGPU bills duration + ~60s warm-up. duration=60 → ~120s billed.
|
| 828 |
-
# With HF_TOKEN set, @spaces.GPU is never called. Zero quota used.
|
| 829 |
-
# ═
|
| 830 |
if _USE_LOCAL:
|
| 831 |
@spaces.GPU(duration=60)
|
| 832 |
def advance_day(nudge_type=None, nudge_value=None, nudge_target=None):
|
|
|
|
| 4 |
Build Small Hackathon 2026 — Thousand Token Wood track.
|
| 5 |
Model: Qwen/Qwen2.5-1.5B-Instruct (≤4B → Tiny Titan badge!)
|
| 6 |
"""
|
| 7 |
+
|
|
|
|
|
|
|
| 8 |
from __future__ import annotations
|
| 9 |
import json, os, random, textwrap, traceback, re
|
| 10 |
from datetime import datetime
|
|
|
|
| 133 |
"MOLE: One cryptic sentence."
|
| 134 |
)
|
| 135 |
|
| 136 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
import os as _os
|
| 138 |
import requests as _req
|
| 139 |
from huggingface_hub import InferenceClient as _InfClient
|
|
|
|
| 395 |
return day_number, parsed, classified
|
| 396 |
|
| 397 |
|
| 398 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 399 |
if _USE_LOCAL:
|
| 400 |
@spaces.GPU(duration=60)
|
| 401 |
def advance_day(nudge_type=None, nudge_value=None, nudge_target=None):
|