File size: 7,137 Bytes
3dbb0ff
 
2206408
3dbb0ff
 
 
 
 
 
 
2206408
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3dbb0ff
 
 
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
---
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 `Qwen/Qwen2.5-Coder-7B-Instruct` via HuggingFace Inference API.

Specialized in **GDAL/OGR**, **Rasterio**, **GeoPandas**, **xarray**, and geospatial development across multiple programming languages.

![Python](https://img.shields.io/badge/Python-3.10+-blue.svg)
![Gradio](https://img.shields.io/badge/Gradio-4.19+-orange.svg)
![License](https://img.shields.io/badge/License-AGPL--3.0-green.svg)

## ✨ Features

- **πŸ—ΊοΈ Geospatial Expertise**: Deep knowledge of GDAL, Rasterio, GeoPandas, PyProj, xarray, and rioxarray
- **πŸ’» Multi-Language Support**: Python, Java, C/C++, JavaScript, TypeScript, Rust
- **πŸ“₯ Download Options**: Export responses as Markdown, Jupyter Notebooks, or code files
- **🎨 Code Editor Style UI**: Syntax highlighting with dark theme
- **πŸ”’ BYOT (Bring Your Own Token)**: Uses your HuggingFace API token for inference
- **⚑ Streaming Responses**: Real-time token streaming for better UX

## πŸš€ 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                                 |
| ---------------- | -------------------------------- | ------------------------------------------- |
| `MODEL_ID`       | `Qwen/Qwen2.5-Coder-7B-Instruct` | HuggingFace model                           |
| `MAX_NEW_TOKENS` | `2048`                           | Maximum response length                     |
| `TEMPERATURE`    | `0.3`                            | Sampling temperature (lower = more focused) |
| `TOP_P`          | `0.9`                            | Nucleus sampling threshold                  |

## πŸ”‘ API Token

This application requires a **HuggingFace API token** for inference. This design:
- βœ… Keeps the Space free (no server-side costs)
- βœ… Prevents token limit overflow
- βœ… Gives users control over their usage

Get your free token at: [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens)

## πŸ› οΈ 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 [Qwen2.5-Coder](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct)
- Built with [Gradio](https://gradio.app/)

## About the Developer

Built by Dr. Kazi Rifat Ahmed, a **Full Stack Geospatial AI Engineer** specializing in:
- AI/ML-DL for geospatial applications
- Cloud-native geospatial software engineering & architecture
- Large-scale Satellite/Earth Observation data data analysis, processing, analytics, and visualization
- Blockchain and Quantum Computing for geospatial applications
- Research Advanced Geospatial Science, Technology, and Applications
- Co-founder and Technical Lead for Satellite Data Services business in Space sector, i.e., QuentuED (https://quentued.de) and Sensor Aktor (https://sensor-aktor.de)

### Tech Stack Proficiency
Python | Java | JavaScript | TypeScript | C/C++ | Bash | Cloud-Native Architecture (kubernetes) | DevOps | AI/ML/DL | MLOps | LLM Integration | Blockchain | Remote Sensing Science & Technology | Geospatial Data Science & Engineering

### Research Interests
Geospatial AI | Satellite Data Engineering | Drone Sensors | Geospatial Big Data Analytics | Earth Observation Systems & Sensors | Advanced Remote Sensing Techniques | Space Technology | Quantum Computing | Blockchain | | Satellite Data Services | Planetary Science & Exploration

## 🀝 Contributing

Contributions are welcome! Please:

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Run tests: `pytest test_app.py -v`
5. Submit a pull request

## πŸ“„ License

This project is licensed under the **GNU Affero General Public License v3.0** (AGPL-3.0).

See [LICENSE](LICENSE.md) for details.

## 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!

---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference