Spaces:
Sleeping
Sleeping
Commit History
-
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 -
Gemini: switch to gemini-2.0-flash; move key to header; redact errors
Three issues surfaced in the live chat box on the HF Space, all from the same Gemini call: LLM provider 'gemini' is unavailable: Gemini call failed: Client error '404 Not Found' for url 'https://generativelanguage.googleapis.com/v1beta/models/ gemini-1.5-flash:generateContent?key=AQ.Ab8RN6Ic8-CB7kqKS1-... (1) Google retired the gemini-1.5 family in mid-2025; the endpoint now returns 404 with a misleading 'model not found' wording. Switching the DEFAULT_MODELS['gemini'] entry to the current free-tier successor 'gemini-2.0-flash' (1M context, same JSON structured-output behaviour) restores parsing. (2) The provider was passing the key in the URL query string, so httpx's HTTPStatusError quoted the FULL request URL including ?key=... into the exception message --- which surfaced verbatim in the chat box and the build log. The key is now sent via the 'x-goog-api-key' HTTP header instead, so even when the next 4xx fires the URL no longer carrie…0f51210 -
LLM provider abstraction + conversational simulation builder + token leak fix
Implements the directive's LLM integration layer cleanly: five providers, zero hard SDK dependencies, never crashes when no key is configured. Also fixes the immediate security issue: the previous deploy attempt embedded a write-scope HF token directly in the git remote URL (visible to anyone running git remote -v). Security fix The token-embedded remote URL was sanitised: git remote set-url space https://huggingface.co/spaces/JoeTach/cdpr-simulator The leaked token MUST also be revoked manually at https://huggingface.co/settings/tokens . See the runbook in docs/hf-auth-troubleshoot.md for the full rotation procedure. src/cdpr/llm/ --- provider-agnostic LLM layer base.py LLMProvider Protocol + LLMMessage / LLMResponse dataclasses + LLMUnavailableError. config.py LLMConfig.from_env() that reads .env via dotenv (optional dep), with canonical env-var names (GEMINI_API_KEY, OPENROUTER_API_KEY, OLLAMA…1f10b7b
-
Smart data ingestion + figure safety + synthetic manifest + HF auth fix
Addresses the directive's six Major Problems without disturbing the primary Gradio workflow at http://127.0.0.1:7860. Major Problem 1 — robust multi-format CSV ingestion New module cdpr.ingest.smart_loader provides load_dataset() and ProfileReport across CSV / TSV / TXT / XLSX / XLS / ODS / Parquet / Feather. Auto-detects format from extension and magic bytes; missing engine surfaces a clean ImportError with the install command rather than a tangled traceback. Timestamp handling: any column whose normalised name matches the alias table (time/timestamp/ts/sec/date/...) OR any string column whose first non-null values parse as datetime is converted to seconds-from-first-sample under a new 't' column. The directive's exact failure case --- 2025-05-07 15:01:27.548198 --- yields t = 0, 1, 2, 3, 4 (seconds). Missing-value handling: recognises the full sentinel set the directive listed (none/None/NULL/NaN/nan/N/A/missing/blank plus common spreadshe…2ad96a7 -
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 -
Dash dashboard: honest re-assessment ships the better frontend for science
Joseph correctly pushed back on the v19 verdict that picked Gradio purely from a generic comparison matrix. Re-evaluating on the actual workload --- long sims, 14-figure plots, many parameter sliders, ML training, scientific researchers as users --- Dash is structurally the better fit for the local research dashboard. Gradio remains the better fit for the public one-click demo. They complement, not compete. Six workload-specific tests that decided the verdict (docs/frontend-architecture-revised.md): 1. Slider tick --- Streamlit full-script rerun (2s), Gradio full event re-render, **Dash only the affected callback updates** (two orders of magnitude less work per tick). 2. Zoom into cable_tensions plot at t=5.2s --- Streamlit/Gradio render matplotlib PNGs (no interaction), **Dash renders native Plotly figures** with built-in zoom/pan/hover/crosshair/PNG-SVG export. Category difference for research workflows. 3. Live loss curves during 30s PINN --- Streaml…d43322a -
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
-
Five built-in CDPR_SIMULATOR examples (3 trajectories + 2 data-driven)
Implements the directive's selectable demonstration set as built-in tutorials accessible identically from PowerShell and the Streamlit GUI. The registry in scripts/examples.py is the single source of truth. Phase 1 — physics-based motion simulation: * circle --- 3-DoF planar circular tracking on the dissertation_8cable robot. 0.05 m radius, 2 revolutions, ~12.6 s, quintic time-scaling for smooth start / stop. * spiral --- 6-DoF helical sweep (the directive's "one example with all six DoFs" requirement). 3-revolution spiral at z = 0.65 m +/- 0.04 m with bounded sinusoidal yaw (+/-17°), pitch (+/-6°) and roll (+/-3°) at distinct phase offsets. Bounded amplitudes (not monotonic rotations) are essential under pure PD: without orientation feedforward, a growing angle saturates the QP --- bounded oscillation keeps the angular error inside the cable wrench envelope…4a660db -
Phase-2 hardening sweep: parametric robots, URL CSVs, schema aliases
Implements all 14 improvements proposed in the post-mortem of the dissertation_8cable CSV failure log: #1 Register dissertation_8cable in the canonical build_robot() factory. The directive geometry moved from scripts/run_simulation.py into src/cdpr/robots/dissertation.py and is now reachable through the same public API as the catalog robots. Replay / PPO / SAC no longer crash on CSVs produced by --preset dissertation-circle. #2 Persist the full robot description (anchors, attachments, mass, inertia, tension bounds) in manifest.json under a new "robot_spec" block. A manifest-aware helper, robot_from_manifest_or_catalog, rebuilds any robot from this block --- catalog OR custom JSON OR inline override. Phase-2 workflows now work on any run_simulation.py output regardless of geometry source. #3 Cable-indexed column filter requires a numeric suffix. ``Layer`` no longer crashes the loader with int('ayer'). Same fix in train_from_csv, compare_…bdbf666 -
Unified Phase-1 + Phase-2 workflow with dual web/PowerShell parity
This commit fulfils the unified recovery directive: Phase-1 defined- trajectory simulation and Phase-2 CSV-driven training are now first- class on both the PowerShell terminal and the Streamlit web interface, with the CLI as the guaranteed scientific fallback while the deployed Streamlit Cloud worker remains intermittently flaky. Phase-1 (scripts/run_simulation.py): * 13 publication-grade figures per run (was 6) --- position, velocity, angular_velocity, acceleration, cable_tensions, cable_lengths, cable_stretch, tracking_error, rms_error_evolution, condition_number, trajectory_xy/_xz/_yz, scene_3d. Each plot wrapped in try/except so a single failure never drops the others; matplotlib figures are explicitly closed after savefig to bound worker memory. Phase-2 (scripts/train_from_csv.py + scripts/compare_models.py): * Five workflows on the CSVs Phase-1 emits: replay (analytic re-sim), mlp + pinn (supervised inverse-dynamics fit, z-scored I/O so loss curves are interpretab…310e4a9
-
docs: add live deployment-status report
Snapshot of the connection map + URLs + remaining loose ends after the GitHub/Render/Streamlit/Cloudflare/Supabase wiring is in place. Auto-published to https://cdpr-simulator.pages.dev/deployment-status on push (Cloudflare Pages serves docs/ as-is).b0b011e -
Initial commit: cdpr Phases 1-7 + deployment scaffolding
Scientific core (Phase 1): - Pose/Twist/Wrench primitives, SE(3) algebra - Robot configuration (anchors, attachments, inertia, cable limits) - Inverse + forward kinematics, structure matrix - Tension distribution (bounded QP), wrench feasibility - Three per-cable physics: massless, linear-elastic, Irvine catenary - Rigid-body Newton-Euler dynamics, RK4 + semi-implicit integrators - Workspace analysis (WCW, WFW, voxel grid) - Parametric trajectories with retiming - Reference robot catalogue (IPAnema-class, CoGiRo-class) Visualisation + ingestion + reports (Phase 2): - 2D analytics, 3D scene with tension heatmap and singularity indicator - Animation (playback, frame stepping, live streaming) with MP4/GIF export - Workspace volume rendering - Experiment recording (CSV + JSON metadata + reproducibility manifest) - Replay engine + dataset comparison - Publication-grade reports: LaTeX figures, booktabs tables, Markdown - FastAPI service + Streamlit research console - Optional external-physi…5f38e95