Spaces:
Runtime error
Runtime error
File size: 9,116 Bytes
143badf 140e195 143badf 722d9da 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 143badf 140e195 f9acb47 140e195 143badf f9acb47 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
---
title: GASM Enhanced - Geometric Language AI
emoji: ๐
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 4.16.0
app_file: app.py
pinned: false
license: cc-by-nd-4.0
---
# ๐ GASM Enhanced - Geometric Attention for Spatial Understanding
> *Bridging natural language and geometric reasoning through SE(3)-invariant neural architectures*
## What Makes This Different?
Traditional AI understands *what* objects are mentioned, but struggles with *where* they are and *how* they relate spatially. GASM changes this.
**GASM** (Geometric Attention for Spatial & Mathematical understanding) represents a breakthrough in AI spatial reasoning:
- **๐ง Advanced NLP**: Goes beyond keywords with spaCy + semantic categorization
- **๐ Proper 3D Math**: Uses SE(3) Lie groups for mathematically correct spatial relationships
- **๐ Geometric Optimization**: Minimizes curvature on Riemannian manifolds for optimal layouts
- **โจ Real-time Visualization**: Shows spatial understanding in live 3D geometry
## ๐ What This Enables
### The Spatial Intelligence Gap
Current language models excel at:
- โ
"What is a keyboard?" โ *An input device*
- โ "Where is the keyboard relative to the monitor?" โ *Spatial confusion*
GASM bridges this gap through mathematical spatial reasoning.
### Real Applications
This isn't just a demo - GASM addresses actual problems in:
- **๐ค Robotics**: "Move the component above the platform" โ Precise 3D coordinates
- **๐ฌ Scientific Modeling**: "The electron orbits the nucleus" โ Proper geometric relationships
- **๐๏ธ Engineering**: "Place the support between the beams" โ Constraint satisfaction
- **๐ฅฝ AR/VR**: Natural language to 3D scene understanding
## ๐ฏ Try It Yourself
### Watch GASM in Action
Input any sentence with spatial relationships:
> *"The ball lies left of the table next to the computer, while the book sits between the keyboard and the monitor."*
**GASM Output:**
- โ
**6 entities identified**: ball, table, computer, book, keyboard, monitor
- ๐ **5 spatial relations**: left_of, next_to, between
- ๐ **3D geometric layout** with proper SE(3) positioning
- ๐ **Curvature evolution** showing geometric convergence
### More Examples
**๐ค Robotics**: *"The robotic arm moves the satellite component above the assembly platform."*
**๐ฌ Scientific**: *"The electron orbits the nucleus while the magnetic field flows through the crystal."*
**๐ Everyday**: *"The red car parks between two buildings near the park entrance."*
### What You'll See
1. **Advanced Entity Recognition**: Far beyond simple keyword matching
2. **Spatial Relationship Extraction**: Understands "left of", "between", "above" in context
3. **3D Visualization**: Real geometric positioning in proper 3D space
4. **Mathematical Convergence**: Curvature evolution showing optimization progress
## ๐ Project Structure
```
GASM-Huggingface/
โโโ app.py # Main Gradio application with complete interface
โโโ gasm_core.py # Core GASM implementation with SE(3) math
โโโ fastapi_endpoint.py # Optional API endpoints (standalone)
โโโ requirements.txt # Python dependencies
โโโ README.md # This file
```
## ๐งฎ The Mathematics Behind GASM
### What Makes It Special
Unlike traditional NLP that treats text as sequences of tokens, GASM understands geometry:
**1. SE(3) Invariant Processing**
- Uses Special Euclidean Group SE(3) for proper 3D transformations
- Maintains mathematical correctness under rotations and translations
- Employs Lie group operations for geometric learning
**2. Advanced Entity Recognition**
- **spaCy NLP**: Part-of-speech tagging + named entity recognition
- **Semantic Filtering**: Domain-specific vocabularies (robotics, scientific, everyday)
- **Contextual Understanding**: Extracts objects from spatial prepositions
**3. Geometric Optimization**
- **Geodesic Distances**: Shortest paths on SE(3) manifold
- **Discrete Curvature**: Graph Laplacian eigenvalue-based computation
- **Energy Minimization**: Constraint satisfaction via Lagrange multipliers
### Technical Architecture
```
Text โ spaCy NLP โ Entity Extraction โ Semantic Filtering
โ
SE(3) Embedding โ Attention Mechanism โ Geometric Refinement
โ
Constraint Satisfaction โ Curvature Optimization โ 3D Visualization
```
### Why This Matters
Most AI systems use simple word embeddings that lose spatial meaning. GASM preserves geometric relationships through mathematically principled operations, enabling true spatial understanding.
## ๐จ Visualizations
The Space provides two main visualizations:
### 1. Curvature Evolution Plot
- Shows geometric convergence over iterations
- Displays SE(3) manifold optimization progress
- Uses matplotlib with dark theme for clarity
### 2. 3D Entity Space Plot
- Interactive 3D positioning of extracted entities
- Color-coded by entity type (robotic, physical, spatial, etc.)
- Shows relationship connections between entities
## ๐ฌ How It Works
1. **Text Input**: User provides text for analysis
2. **Entity Extraction**: Regex-based extraction of meaningful entities
3. **Relation Detection**: Identification of spatial, temporal, physical relations
4. **GASM Processing**: If available, real SE(3) forward pass through geometric manifold
5. **Visualization**: Generate curvature evolution and 3D entity plots
6. **Results**: Comprehensive analysis with JSON output
## โก Performance
- **CPU Mode**: Optimized for HuggingFace Spaces CPU allocation
- **GPU Fallback**: Automatic ZeroGPU usage when available
- **Memory Efficient**: ~430MB total memory footprint
- **Fast Processing**: 0.1-0.8s processing time depending on text length
## ๐ ๏ธ Local Development
To run locally:
```bash
git clone <this-repo>
cd GASM-Huggingface
# Install dependencies
pip install -r requirements.txt
# Run the application
python app.py
```
## ๐ Space Configuration
This Space is configured with:
- **SDK**: Gradio 4.44.1+
- **Python**: 3.8+
- **GPU**: ZeroGPU compatible (A10G/T4 fallback)
- **Memory**: 16GB RAM allocation
- **Storage**: Persistent storage for model caching
## ๐ API Endpoints
The Space also exposes FastAPI endpoints (when fastapi_endpoint.py is run separately):
- `POST /process`: Process text with geometric enhancement
- `GET /health`: Health check and memory usage
- `GET /info`: Model configuration information
## ๐ Use Cases
Perfect for analyzing:
- **Technical Documentation**: Spatial relationships in engineering texts
- **Scientific Literature**: Physical phenomena and experimental setups
- **Educational Content**: Geometry and physics explanations
- **Robotic Systems**: Assembly instructions and spatial configurations
## ๐ฏ Model Details
- **Base Architecture**: Built on transformer foundations
- **Geometric Processing**: SE(3) Lie group operations
- **Attention Mechanism**: Geodesic distance-based attention weighting
- **Curvature Computation**: Discrete Gaussian curvature via graph Laplacian
- **Constraint Handling**: Energy minimization with Lagrange multipliers
## ๐ Why This Matters
### Current State of AI
- โ
Excellent at text understanding and generation
- โ
Great at image recognition and computer vision
- โ **Struggles with spatial reasoning from language**
- โ **Can't bridge text โ 3D geometry gap**
### GASM's Contribution
GASM represents a step toward AI that understands space the way humans do - not just as coordinates, but as meaningful geometric relationships between objects in the world.
**Applications on the horizon:**
- ๐ค Robots that understand spatial instructions naturally
- ๐๏ธ AI architects that reason about 3D spaces from descriptions
- ๐ฌ Scientific AI that models physical systems geometrically
- ๐ฎ Game AI that understands spatial gameplay naturally
## ๐ ๏ธ Local Development
```bash
git clone https://github.com/scheitelpunk/GASM-Huggingface
cd GASM-Huggingface
pip install -r requirements.txt
python app.py
```
The system gracefully handles missing dependencies with intelligent fallbacks.
## ๐ค Contributing
This is active research in spatial AI! We welcome:
- ๐ Bug reports and edge cases
- ๐ก New spatial relationship types
- ๐ Additional language support
- ๐ Evaluation datasets
- ๐ง Performance optimizations
## ๐ License & Citation
Licensed under CC-BY-NC 4.0. For research use, please cite:
```bibtex
@misc{gasm2025,
title={GASM: Geometric Attention for Spatial Understanding},
author={Michael Neuberger, Versino PsiOmega GmbH},
year={2025},
url={https://huggingface.co/spaces/scheitelpunk/GASM}
}
```
## ๐ Built With
- ๐ค **Hugging Face Spaces** - Deployment platform
- ๐ **spaCy** - Advanced NLP processing
- ๐ข **PyTorch** - Neural network framework
- ๐ **Gradio** - Interactive ML interfaces
- ๐ **Geomstats** - Geometric computing
---
*GASM: Where language meets geometry, and AI begins to understand space.* ๐
Built by Michael Neuberger, Versino PsiOmega GmbH |