--- title: Geoai Coding Agent emoji: 🌍 colorFrom: pink colorTo: red sdk: gradio sdk_version: 6.3.0 app_file: app.py pinned: false license: agpl-3.0 tags: - geospatial - geospatial-ai - AI - ML - DL - LLM - satellite-data - earth-observation - nlp - maps - data-visualization - natural-language - gradio - huggingface short_description: GeoAI Coding Agent - Geospatial AI Coding Assistant" --- # 🌍 GeoAI Coding Agent A **Geospatial AI Coding Assistant** powered by multiple LLMs via HuggingFace Inference Providers. Specialized in **GDAL/OGR**, **Rasterio**, **GeoPandas**, **xarray**, and geospatial development across multiple programming languages. Designed for **beginner and intermediate learners** with educational explanations. ![Python](https://img.shields.io/badge/Python-3.10+-blue.svg) ![Gradio](https://img.shields.io/badge/Gradio-6.3+-orange.svg) ![License](https://img.shields.io/badge/License-AGPL--3.0-green.svg) ## ✨ Features - **πŸ€– Multiple AI Models**: Choose from 6 different models (DeepSeek, Kimi, Llama, MiniMax, GLM, Mistral) - **πŸ—ΊοΈ Geospatial Expertise**: Deep knowledge of GDAL, Rasterio, GeoPandas, PyProj, xarray, and rioxarray - **πŸ“š Educational Focus**: Responses include code explanations, step-by-step logic, and tips for beginners - **πŸ’» Multi-Language Support**: Python, Java, C/C++, JavaScript, TypeScript, Rust - **πŸ“₯ Download Options**: Export responses as Markdown or code files - **🎨 Code Editor Style UI**: Syntax highlighting with dark theme - **⚑ Streaming Responses**: Real-time token streaming for better UX ## πŸ€– Available Models | Model | Provider | Speed | Best For | |-------|----------|-------|----------| | **DeepSeek V3.2** | Novita | Medium | Complex geospatial tasks, detailed explanations | | **Kimi K2 Instruct** | Novita | Medium | General coding, good balance | | **Llama 3.1 8B** | Novita | Fast | Quick answers, simple tasks | | **MiniMax M2.1** | Novita | Medium | Creative solutions | | **GLM 4.7 Flash** | Novita | Fast | Fast responses, basic tasks | | **Mistral 7B v0.2** | Featherless | Fast | Quick prototyping | > πŸ’‘ **Tip**: Larger models provide better results but take longer. Smaller models are faster for simple queries. ## πŸš€ Quick Start ### Local Development 1. **Clone the repository** ```bash git clone https://github.com/rifatSDAS/geoai-coding-agent.git cd geoai-coding-agent ``` 2. **Create virtual environment** ```bash python -m venv venv source venv/bin/activate # Linux/Mac # or venv\Scripts\activate # Windows ``` 3. **Install dependencies** ```bash pip install -r requirements.txt ``` 4. **Run the application** ```bash python app.py ``` 5. **Open in browser**: Navigate to `http://localhost:7860` 6. **Enter your HuggingFace token**: Get one at [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) ### Run Tests ```bash pytest test_app.py -v ``` ## 🐳 HuggingFace Spaces Deployment 1. **Create a new Space** at [huggingface.co/new-space](https://huggingface.co/new-space) - Select **Gradio** as the SDK - Choose **CPU basic** (free tier) 2. **Upload files** - `app.py` - `config.py` - `requirements.txt` - `README.md` (optional) 3. **That's it!** The Space will automatically build and deploy. ## πŸ“ Project Structure ``` geoai-coding-agent/ β”œβ”€β”€ app.py # Main Gradio application β”œβ”€β”€ config.py # Configuration, prompts, templates β”œβ”€β”€ test_app.py # Unit tests β”œβ”€β”€ requirements.txt # Python dependencies β”œβ”€β”€ .gitignore # Git ignore rules └── README.md # This file ``` ## 🎯 Example Queries - *"Read a GeoTIFF with rasterio and calculate NDVI from Sentinel-2 bands"* - *"Convert shapefile to GeoJSON using GDAL/OGR in Python"* - *"Reproject a raster from EPSG:4326 to EPSG:32632 using rasterio"* - *"Clip a large COG raster to a polygon boundary using rioxarray"* - *"Create a spatial join between two GeoDataFrames in GeoPandas"* - *"Implement parallel raster processing with GDAL in C++"* ## βš™οΈ Configuration Key settings in `config.py`: | Parameter | Default | Description | | ------------------ | ----------------- | ------------------------------------------- | | `DEFAULT_MODEL` | `DeepSeek V3.2` | Default model selection | | `MAX_NEW_TOKENS` | `2048` | Maximum response length | | `TEMPERATURE` | `0.3` | Sampling temperature (lower = more focused) | | `TOP_P` | `0.9` | Nucleus sampling threshold | | `AVAILABLE_MODELS` | (see table above) | Dictionary of available models & providers | ## πŸ”‘ API Token This application requires a **HuggingFace API token** with Inference Provider permissions. **Required permissions**: - βœ… Make calls to Inference Providers Get your free token at: [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) For HuggingFace Spaces deployment, add the token as a **Secret** named `HF_TOKEN` in Space Settings. ## πŸ› οΈ Supported Languages | Language | Extension | Use Case | |------------|--------------|-------------------------------| | Python | `.py` | GDAL, Rasterio, GeoPandas | | Java | `.java` | GeoTools, JTS | | C/C++ | `.c`, `.cpp` | GDAL C API, performance | | JavaScript | `.js` | Leaflet, OpenLayers, Turf.js | | TypeScript | `.ts` | Type-safe geospatial apps | | Rust | `.rs` | GDAL Rust bindings, geo crate | ## πŸ“¦ Dependencies - **gradio**: Web UI framework - **huggingface-hub**: HF Inference API client - **pytest**: Testing framework ## πŸ™ Acknowledgments - Inspired by [GeoAI-Assistance-Ext](https://github.com/rifatSDAS/GeoAI-Assistance-Ext) VS Code Extension - Powered by multiple LLMs via [HuggingFace Inference Providers](https://huggingface.co/docs/huggingface_hub/guides/inference) - Built with [Gradio](https://gradio.app/) ## About the Developer Built by Dr. Kazi Rifat Ahmed, a Full Stack Geospatial AI Engineer, Co-founder and Technical Lead for Satellite Data Services business in Space sector. ## Contributing Contributions welcome! Please feel free to submit issues and pull requests. ## Contact For collaboration opportunities in satellite data services & applications, large-scale satellite data analytics, geospatial AI, blockchain & quantum computing for geospatial applications, or advanced geospatial science, technology & applications, feel free to reach out! Portfolio at https://rifatsdas.github.io/ ## πŸ“„ License This project is licensed under the **GNU Affero General Public License v3.0** (AGPL-3.0). See [LICENSE](LICENSE.md) for details. --- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference