CoolFace
Apppublic

cdshelat/MorphAI

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
README.md72 linesDownload Raw Back to root
1---2title: MorphAI3emoji: 🔧4sdk: docker5pinned: false6---7 8# MorphAI — AI-Driven Topology Optimizer for FDM 3D Printing9 10Describe a mechanical part in plain English. MorphAI extracts the boundary conditions, runs the SIMP topology optimization algorithm, and gives you a print-ready STL with calibrated von Mises stress output — in under 60 seconds.11 12[Live demo on HF Spaces](https://huggingface.co/spaces/cdshelat/MorphAI) · [Watch the demo](TODO)13 14---15 16## What's interesting about this17 18- **Natural language → engineering constraints.** A Claude/GPT extraction layer reads a plain-English description ("wall bracket, holds 20 kg, fixed left, PLA") and extracts face constraints, force direction, magnitude, and material — no form-filling required. This is one of the few AI generalist projects applying LLMs to physics-based optimization rather than text or image tasks.19 20- **Hand-implemented SIMP solver.** The topology optimizer is not a wrapper around an existing solver library. The SIMP (Solid Isotropic Material with Penalization) algorithm, sparse FEA stiffness assembly, density filter, and optimality criteria update are written from scratch using NumPy and SciPy sparse. The same algorithm is used in aerospace and automotive design tools costing tens of thousands of dollars.21 22- **2D + 3D solver pipeline.** The 2D Q4 plane-stress solver handles most bracket and plate problems. A true 3D hexahedral solver (`simp_core_3d`) is available for volumetric parts — same SIMP loop, 24 DOF per hex element, full 3D stress and displacement fields.23 24- **Physically calibrated stress output.** Von Mises stress is returned in real MPa (not normalized), scaled by actual force magnitude and element size, compared against material yield strength with a user-chosen safety factor. The result is actionable for real print decisions.25 26---27 28## Tech stack29 30Streamlit · NumPy · SciPy sparse · scikit-image (marching cubes) · Plotly 3D · litellm (multi-provider LLM gateway) · trimesh31 32---33 34## Running locally35 36```bash37git clone https://github.com/chintan-dshel/morph-ai38cd morph-ai39pip install -r requirements.txt40streamlit run app.py41```42 43Click a **Quick Start preset** — results in ~30 seconds, no API key needed. To enable AI chat extraction, add your key in the AI Settings panel (never written to disk). With `ANTHROPIC_API_KEY` set as an environment variable, the key is loaded automatically.44 45---46 47## Secrets (for Space operators)48 49Set `ANTHROPIC_API_KEY` as a Space Secret to enable the chat extraction feature for all visitors without requiring them to supply their own key.50 51---52 53## Planned v254 55A React + FastAPI prototype with no Streamlit dependency lives in `frontend-experimental/`. Planned work: wire the LLM extraction layer from `chat.py` into the FastAPI backend.56 57---58 59## Validation60 61The MBB beam benchmark (Sigmund 2001) is built in. Under Convergence → MBB Benchmark:62 63- nelx=60, nely=20, volfrac=0.5, p=3, rmin=1.564- Expected compliance: **C ≈ 187.96**65- Pass threshold: < 5% error66 67---68 69## License70 71MIT72