aira-v2 / README.md
jonathan4e's picture
Deploy AIRA v2 - Qwen vision + voice + heat safety
ca5137c verified
|
Raw History Blame Contribute Delete
3.41 kB
---
title: AIRA v2 — Arid-climate Intelligent Risk Assistant
emoji: 🌡️
colorFrom: yellow
colorTo: red
sdk: gradio
sdk_version: 4.44
app_file: app.py
pinned: false
license: mit
---
# 🌡️ AIRA v2 — Arid-climate Intelligent Risk Assistant
**AI-powered voice & vision safety copilot for heat-exposed workers in Qatar.**
Built for the **QAI × Hugging Face Hackathon**. Aligned with **Qatar National Vision 2030 — Quality of Life**.
## 🏗️ Architecture — Full Qwen Stack
| Layer | Model | Role |
|-------|-------|------|
| 👁️ **Vision** | `Qwen/Qwen2-VL-2B-Instruct` | Image analysis of job-site heat-stress indicators |
| 🧠 **Reasoning** | `Qwen/Qwen3-4B-Instruct` | WBGT calculation, hydration & work-rest planning (Qatar MoPH aligned) |
| 🎤 **STT** | `openai/whisper-tiny` | Speech-to-text in Arabic / Hindi / Urdu / English |
| 🔊 **TTS** | `gTTS` | Spoken safety advice read back to worker |
| 🌤️ **Weather** | Open-Meteo API | Live Qatar temperature & humidity |
## 📁 Repository Structure
```
AIRA/
├── app.py # Gradio Space: Vision + Qwen3 Reasoning + Voice + WBGT Safety
├── train_qwen_vision.py # LoRA fine-tuning script for Qwen2-VL on heat-stress imagery
├── requirements.txt # Python dependencies
└── README.md # This file (HF Space metadata + docs)
```
## 🚀 Deploy to Hugging Face Spaces
### Prerequisites
> ⚠️ Gradio Spaces require a **HF Pro subscription** on cpu-basic hardware.
> Subscribe at https://huggingface.co/pro (your $100 credits can cover this).
### One-command deploy
```bash
# Install HF CLI
curl -LsSf https://hf.co/cli/install.sh | bash -s
# Login (you must do this yourself)
hf auth login
# Create + upload the Space (run once Pro is active)
hf repos create jonathan4e/aira-v2 --type space --sdk gradio --exist-ok
hf upload jonathan4e/aira-v2 --type space app.py requirements.txt README.md --commit-message "Deploy AIRA v2"
hf spaces settings jonathan4e/aira-v2 --hardware t4-small
hf spaces wait jonathan4e/aira-v2 --timeout 600
```
**Your Space URL:** `https://huggingface.co/spaces/jonathan4e/aira-v2`
## 🎯 Fine-tune Qwen2-VL on Your Own Dataset
```bash
# 1. Create/push a heat-stress image dataset to HF
python create_dataset.py --push jonathan4e/aira-heat-stress
# 2. Fine-tune Qwen2-VL-2B with LoRA (PEFT)
python train_qwen_vision.py \
--dataset jonathan4e/aira-heat-stress \
--output jonathan4e/aira-qwen2vl-heat \
--epochs 1 --batch 2
# 3. Update app.py VISION_MODEL_ID to your fine-tuned model
```
## 🧠 WBGT Safety Logic (Qatar MoPH Aligned)
- **WBGT estimate** from temperature + humidity + solar load
- **Risk bands:** Low (<29°C), Moderate (29–31°C), High (31–33°C), Extreme (>33°C)
- **Output:** hydration (L/hr), work/rest cycle (min work / min rest shade), immediate actions
- Multilingual: English, Arabic, Hindi, Urdu
## 📱 Demo Features
- `gr.Examples` pre-loaded for instant hackathon judging
- Mobile-responsive Gradio UI with RTL support for Arabic/Urdu
- Voice input → transcription → Qwen3 reasoning → TTS audio output
- Image upload → Qwen2-VL heat-stress classification
## 🇶🇦 Alignment
Supports **Qatar National Vision 2030 — Quality of Life** by protecting outdoor, logistics, and construction workers from extreme summer heat with free, open-source, mobile-accessible AI.
## 📄 License
MIT