Spaces:
Running on Zero
Running on Zero
File size: 5,208 Bytes
7c634d8 85a30b6 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 7c634d8 26d9869 | 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 | ---
title: Agentic Disaster Tracker
emoji: π
colorFrom: red
colorTo: blue
sdk: gradio
sdk_version: 4.44.1
app_file: app.py
pinned: false
license: mit
---
<div align="center">
# π Agentic Disaster Tracker
### AI-Powered Natural Disaster Intelligence
**Ask questions about global earthquakes and wildfires in natural language β driven by autonomous AI agents.**
[](https://python.org)
[](https://gradio.app/)
[](https://huggingface.co/Qwen)
[](LICENSE)
<br/>
[Features](#-features) Β· [How It Works](#-how-it-works) Β· [Installation](#-installation) Β· [Tech Stack](#-tech-stack)
</div>
---
## β What is Agentic Disaster Tracker?
Agentic Disaster Tracker is an intelligent, autonomous agent designed to fetch real-time global disaster data. By seamlessly integrating **Tool Calling (Function Calling)** capabilities, the system bridges the gap between Large Language Models (LLMs) and real-world Public APIs.
Ask the AI about recent earthquakes or active wildfires, and the underlying **Agentic Loop** will autonomously decide which API to call, fetch the live data, and synthesize a comprehensive, natural language response.
> **Transparent Intelligence:** Watch the AI think! Every tool call, parameter, and raw JSON response is displayed in real-time, offering a completely transparent view into the model's decision-making process.
---
## β¨ Features
| Feature | Description |
|---|---|
| π€ **Autonomous Tool Calling** | The assistant intelligently decides whether to query the Earthquake API or the Wildfire API based purely on your conversational input. |
| π **Transparent Execution** | The UI explicitly reveals the AI's internal monologue, the exact API functions it triggers, the parameters sent, and the raw data received. |
| π§ **Powerful Qwen 2.5 LLM** | Powered by `Qwen/Qwen2.5-7B-Instruct`, a state-of-the-art open-source model highly optimized for complex function calling tasks. |
| β‘ **ZeroGPU Serverless Execution** | Seamlessly deployed on Hugging Face Spaces using the `@spaces.GPU` decorator, ensuring efficient, serverless inference for a 7B model. |
| π **Live Public API Integration** | Directly connected to USGS (United States Geological Survey) and NASA EONET for up-to-the-minute global disaster data. |
---
## π§ How It Works
```mermaid
flowchart LR
A["π€ User Query<br/><small>'List recent earthquakes'</small>"] --> B["π§ Qwen 2.5 Agent<br/><small>Analyzes Intent</small>"]
B --> C{"π οΈ Tool Selection"}
C -->|Earthquakes| D["USGS API<br/><small>get_earthquakes()</small>"]
C -->|Wildfires| E["NASA EONET API<br/><small>get_wildfires()</small>"]
D --> F["π Raw JSON Data"]
E --> F
F --> G["π€ Synthesize Response"]
G --> H["π¬ Final Answer provided to User"]
style A fill:#0d8a6a,color:#fff,stroke:none
style B fill:#10a37f,color:#fff,stroke:none
style G fill:#10a37f,color:#fff,stroke:none
style H fill:#0d8a6a,color:#fff,stroke:none
```
**Pipeline in detail:**
1. **Input** β You ask a natural language question (e.g., "Were there any magnitude 5.5+ earthquakes in the last 3 days?").
2. **Analysis** β The Qwen 2.5 model parses your request and identifies the need for external data.
3. **Execution** β The Agentic Loop triggers the appropriate python function (Tool Call) with the correct parameters (dates, magnitude).
4. **Data Retrieval** β Live data is fetched from public USGS or NASA endpoints.
5. **Synthesis** β The model ingests the raw JSON output and formulates a human-readable, conversational summary.
---
## π οΈ Installation
Run the Agentic Disaster Tracker locally on your machine.
### 1. Clone the Repository
```bash
git clone https://github.com/MertAlii/Agentic-Disaster-Tracker.git
cd Agentic-Disaster-Tracker
```
### 2. Install Dependencies
> β οΈ Note: Running a 7B parameter model locally requires adequate RAM and ideally a dedicated GPU.
```bash
pip install -r requirements.txt
```
### 3. Start the Application
```bash
python app.py
```
The Gradio web interface will launch and be available at `http://127.0.0.1:7860/`.
---
## ποΈ Tech Stack
<div align="center">
| Layer | Technology | Role |
|---|---|---|
| **Frontend UI** | Gradio 4.44.1 | Interactive Chat Interface |
| **LLM Engine** | Qwen/Qwen2.5-7B-Instruct | Intent parsing, Tool Calling & Synthesis |
| **Inference Hardware** | Hugging Face ZeroGPU | Serverless GPU acceleration |
| **Earthquake Data** | USGS Earthquake API | Real-time seismic event tracking |
| **Wildfire Data** | NASA EONET API | Active global wildfire monitoring |
</div>
---
<div align="center">
**Built with β€οΈ for the Tool Calling Assignment.**
</div>
|