Spaces:
Sleeping
Sleeping
File size: 2,418 Bytes
e05e111 5194558 e05e111 5194558 | 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 | ---
title: Tokyo Weather Forecast Lab
sdk: gradio
app_file: app.py
pinned: false
---
# WeatherPred
A Gradio app for comparing Tokyo five-day weather forecasts from Open-Meteo with a local ONNX model forecast.
## Repository Layout
```text
app.py # HuggingFace Spaces entrypoint
weatherpred/ # Application package
config.py # Paths, constants, Tokyo coordinates
data.py # Open-Meteo fetch and CSV/JSON cache
modeling.py # ONNX inference and forecast comparison
agent.py # Gemini-backed agent orchestration and fallback logic
prompts.py # LLM routing and response prompts
tools.py # Deterministic forecast/trend/seasonality/model tools
dashboard.py # Gradio UI
zerogpu.py # HuggingFace ZeroGPU compatibility
models/mock_model/ # ONNX model artifacts
scripts/ # Data/model utility scripts
requirements.txt # Runtime dependencies
requirements-train.txt # Optional model training dependencies
```
## Local Run
```bash
pip install -r requirements.txt
python scripts/fetch_historical_weather.py
python app.py
```
## HuggingFace ZeroGPU
Free HuggingFace Gradio Spaces may run on ZeroGPU only. A tiny hidden compatibility probe is decorated with `@spaces.GPU(duration=10)` so the Space satisfies the ZeroGPU startup check, while the real weather dashboard refresh remains CPU-based. The local fallback keeps the app runnable outside HuggingFace.
## Agent Capabilities
The chat agent uses Gemini when `GEMINI_API_KEY` is available, with a deterministic fallback parser when it is not. It can route user requests to typed Python tools for:
- next-N-day forecasts, up to 16 days
- historical trends over the cached weather history
- seasonal/monthly cyclic patterns
- model-vs-Open-Meteo comparison
- model and data-source explanation
The LLM does not invent forecasts directly; it selects tools and explains their computed results.
## Optional Gemini Briefing
Set `GEMINI_API_KEY` as a HuggingFace Space secret. If it is absent, the app uses deterministic fallback summaries and routing.
## Optional Model Export
```bash
pip install -r requirements-train.txt
python scripts/fetch_historical_weather.py
python scripts/train_export_onnx.py
```
The training helper exports the ONNX model to `models/mock_model/model.onnx`.
|