Spaces:
Sleeping
Sleeping
Commit History
-
Speed up chat + emit >=10 figures/tables per Phase-2 model run
Two user-visible fixes from the post-deployment feedback: 1. Chat felt slower than before the fallback chain landed. Root cause was not the chain itself (it exits on the first parseable response), but three pile-on effects that compound on a cold HF worker: a. max_tokens was 900 for a JSON output that is well under 200. The Gemini free tier generates up to the cap. Lowered to 400. b. Every chat call re-built the provider object, paying the GeminiProvider/_http setup cost on a cold worker. Now cached at module level (_provider_cache). c. LLMConfig.timeout_s was 30s, so a stalled provider cost the full 30 before the chain rolled over. Lowered to 12 with a CDPR_LLM_TIMEOUT_S env override for slow links. gradio_app.py also pre-warms the chain at module load time so the FIRST chat after a Space restart doesn't pay construction cost --- it pays it once, before the user even sees the page. simulation_builder gains…0c4152d
-
LLM fallback chain + Reset button + Accordion UI + per-run audit
Three independent fixes, all driven by the user's report after the last deployment: 1. LLM fallback chain (Gemini 429 -> OpenRouter -> echo). Gemini's free tier rate-limits aggressively (HTTP 429). When the 429 fires the chat used to die with a 'low confidence' note and the user had no fallback. cdpr.llm.config.resolve_fallback_chain now returns an ordered provider list driven by CDPR_LLM_FALLBACK_ CHAIN or, when unset, by which keys are configured. simulation_ builder.describe_to_request walks the chain and uses whichever provider returns parseable JSON first; the echo stub is appended unconditionally so the call never raises. BuilderResult.notes reports which providers were tried and which won. docs/llm- providers.md gains a 'Automatic fallback chain' section. 2. Reset button + collapsible accordion sections. Robot & dynamics / Trajectory / Time / Controller are now wrapped in gr.Accordion (default open=False, like file-tree folders). The Traj…a89fdfb -
Chat box: also infer controller (PD / MPC) and flip the visible group
The conversational simulation builder parses trajectory and robot into a SimulationRequest, but the controller choice deliberately lives in the frontend (it's a UI concern, not part of the request schema). That left a gap: a prompt like 'use MPC' was acknowledged in plain text but the radio stayed on PD, and the MPC gain group stayed hidden. _infer_controller(text) now scans the message for explicit hints: MPC : 'mpc', 'model predictive', 'predictive control', 'receding horizon', 'receding-horizon' PD : 'pd controller', 'proportional derivative', 'proportional-derivative' Falls back to PD (the form default) when nothing matches, so the behaviour is deterministic. _chat_to_form now appends three more updates to its return tuple: * controller_kind : flip the radio * pd_group : visible iff the hint was PD * mpc_group : visible iff the hint was MPC (_FORM_FIELD_COUNT is 19 now, matching the new chat_outputs list.) Programmatic value changes don…78896de -
Gradio UI polish: clean header, MPC controller, conversational chatbox
Three user-requested changes on the Gradio frontend: 1. Header. Drop the developer-facing build-ID subtitle ('Build gradio-2026-05-29-a · scientific-core import OK · runs locally and on Hugging Face Spaces (16 GB CPU worker)') and the 'Gradio frontend' suffix. The page now opens with just 'CDPR Simulator' and a one-paragraph scientific summary covering kinematics, the wrench / tension-distribution QP, rigid-body dynamics, three constitutive cable models (massless / Kelvin-Voigt / Irvine + hybrid), PD/MPC feedback, parametric trajectories, and the Phase-2 PINN/MLP/PPO/SAC data layer. A new how-to card directly under it explains the three tabs in plain language. The BUILD_ID constant is kept for manifests and surfaced in the per-run Console output, not the page header. 2. CSS. Hand-tuned styling for a reserved, instrument-style look (no glass, no rainbows, no animations): slate gradient header with monospace accents on technical terms, left-bor…b6e3041 -
Move Gradio theme to launch() per Gradio 6.0 deprecation
The build succeeded but the worker log carried: UserWarning: The parameters have been moved from the Blocks constructor to the launch() method in Gradio 6.0: theme. Gradio 6.0 deprecates the Blocks(theme=...) form in favour of launch(theme=...). Moved the theme accordingly: * gradio_app.py: Blocks() no longer takes theme; the __main__ block passes theme=gr.themes.Soft() to launch() for the local 'python gradio_app.py' workflow. * app.py: the HF Spaces entrypoint also passes theme=gr.themes.Soft() to launch(), so the deployed Space gets the Soft theme too. Locally: 'python gradio_app.py' still starts at http://127.0.0.1:7860 with the Soft theme. On HF: next rebuild has zero deprecation warnings. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>eafcb90
-
Stabilize multi-UI repo: HF-ready gradio_app + token-based HF deploy guide
Recovery work after an interactive rebase + HF-push attempt failed mid-flight. Per the directive, the rebase was aborted (all work is safe, every previously-shipped commit is preserved) and the broken state replaced with a clean, deployable shape. gradio_app.py Module-level ``demo = build_ui()`` is now executed at import time so Hugging Face Spaces can do ``from gradio_app import demo`` without modification --- and app.py (the tiny shim already in the tree) routes HF's ``app_file: app.py`` declaration straight to this module's demo. The ``__main__`` block stays for local launch at http://127.0.0.1:7860. docs/hf-deployment.md Token-based HF Spaces deployment that does NOT require the huggingface CLI. Covers the three errors the previous attempt hit: in-flight interactive rebase, non-fast-forward push rejection, and missing CLI. The force-push step is scoped to the *first* push only (overwrites HF's auto-README with the local README that already carr…110335d -
Multi-frontend architecture + Gradio alternative + universal terminal guide
The directive asked for an honest architectural assessment of the Streamlit instability rather than more patching, two best-in-class alternatives, multi-frontend coexistence, and universal terminal support. All five requirements satisfied without disturbing the existing CLI / Streamlit / FastAPI stack. Architectural assessment (docs/frontend-architecture.md): * Root cause analysis: Streamlit Cloud's 1 GB / 1 vCPU / WebSocket-only free tier is mismatched to a numpy + scipy + matplotlib + torch workload that imports >600 MB before the first widget renders. Local Streamlit is fine; the cloud tier is the wrong free host. * Comparison matrix scores 6 alternatives across the 15 axes the directive specified. Totals: FastAPI + vanilla JS 65 (max stability, max custom-code cost) Gradio + HF Spaces 62 (best bang-per-integration-hour) Dash + Render 61 (great for Plotly dashboards) Panel 51 (strong locally, weak on free hosts) NiceGUI …4935703