Skip to content

About

AI-powered weather prediction web app using machine learning and real-time Open-Meteo data to predict precipitation and provide weather insights.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Nexus Weather AI - Premium Edition 🌤️

Nexus Weather AI is a cutting-edge, real-time machine learning application that predicts precipitation likelihood based on real atmospheric conditions.

Unlike standard "toy" datasets, Nexus correlates live atmospheric APIs with an inference engine trained on a heavy 10-year real-world historical dataset fetched from the Open-Meteo Archive.

The application is served via a lightweight Flask backend and accessed through a dynamic, premium "glassmorphism" web UI that bridges the gap between raw ML inference and a stellar user experience.


⚡ Core Features

  • Real-Time Forecasting Integration: Users do not need to guess the relative humidity or sea-level pressure. By simply typing a city name (e.g., "Tokyo" or "New York"), the platform pings the Open-Meteo Geocoding & Current Forecast API to automatically pull down live atmospheric variables.
  • Robust Machine Learning Backend: The system trains Logistic Regression, Decision Tree, K-Nearest Neighbors, and Random Forest models on the fly, saving the optimal predictor (Random Forest) to disk.
  • Dynamic State UI: The high-end, responsive HTML/CSS/JS frontend leverages CSS variable injection and micro-animations to seamlessly transition the background and layout based on the neural net's prediction.
  • Exploratory Data Analytics: Real-time plots comparing Model F1-Scores and Feature Importances are served directly to the client interface.

🛠️ Architecture

The project follows a standard MLOps pipeline structure:

  1. Data Ingestion (data/fetch_real_data.py): Connects to Open-Meteo to download 10 years of hourly data across 5 global cities, resamples it to daily aggregates, and generates real_weather.csv.
  2. Preprocessing (src/preprocess.py): Ingests real_weather.csv, handles anomalies, isolates features (Temperature_C, Humidity_pct, Pressure_hPa, Wind_Speed_kmh, Cloud_Cover_pct), and drops the target payload to a StandardScaler.
  3. Training (src/train_model.py): Runs comparative evaluation across algorithms and serializes the winning algorithm to models/model.pkl.
  4. Backend/API (app/app.py): Flask server exposing the frontend and two critical API routes.

🚀 Getting Started

1. Requirements

Ensure you have Python 3.8+ installed.

Install the required dependencies:

pip install -r requirements.txt

2. Execution Orchestrator

The entire pipeline, from raw historical data fetching to ML training, scaling, plotting, and server hosting, is executed via a single orchestrator script:

python run.py

Wait for the data fetching and training to finish. The Flask app will launch on http://127.0.0.1:5000 automatically.


📡 API Documentation

Nexus Weather AI can be interacted with headlessly via standard HTTP requests.

1. GET /api/weather/current?city={city}

Looks up the geographic coordinates of the provided city string, invokes the current conditions forecasting framework, and returns standardized ML inference parameters.

Response:

{
  "city": "London",
  "cloud_cover": 42,
  "country": "United Kingdom",
  "humidity": 68,
  "month": 6,
  "pressure": 1012.5,
  "temperature": 18.2,
  "wind_speed": 14.5
}

2. POST /predict

The core Inference API. Accepts a JSON payload of localized atmospheric conditions and returns the Random Forest precipitation evaluation.

Request:

{
  "month": 6,
  "temperature": 18.2,
  "humidity": 68,
  "pressure": 1012.5,
  "wind_speed": 14.5,
  "cloud_cover": 42
}

Response:

{
  "confidence": 92.4,
  "label": "No Rain",
  "prediction": 0
}

About

AI-powered weather prediction web app using machine learning and real-time Open-Meteo data to predict precipitation and provide weather insights.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages