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.
- 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.
The project follows a standard MLOps pipeline structure:
- 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 generatesreal_weather.csv. - Preprocessing (
src/preprocess.py): Ingestsreal_weather.csv, handles anomalies, isolates features (Temperature_C,Humidity_pct,Pressure_hPa,Wind_Speed_kmh,Cloud_Cover_pct), and drops the target payload to aStandardScaler. - Training (
src/train_model.py): Runs comparative evaluation across algorithms and serializes the winning algorithm tomodels/model.pkl. - Backend/API (
app/app.py): Flask server exposing the frontend and two critical API routes.
Ensure you have Python 3.8+ installed.
Install the required dependencies:
pip install -r requirements.txtThe entire pipeline, from raw historical data fetching to ML training, scaling, plotting, and server hosting, is executed via a single orchestrator script:
python run.pyWait for the data fetching and training to finish. The Flask app will launch on http://127.0.0.1:5000 automatically.
Nexus Weather AI can be interacted with headlessly via standard HTTP requests.
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
}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
}