A LSTM model based AI-Powered Weather Predictor
Maintainer - @Deadpool2000
This project is an AI-powered weather prediction system that fetches real-time weather data using the OpenWeatherMap API and predicts future temperatures using an LSTM (Long Short-Term Memory) neural network.
- Fetches real-time weather data from OpenWeatherMap API 🌍
- Trains an LSTM-based deep learning model for temperature prediction 🔥
- Provides weather predictions via a Flask API 🖥️
- Stores trained models for faster inference ⚡
- Fully modular directory structure 🏗️
AI-Powered-Weather-Predictor/
│── lib/ # External helper functions
│ ├── openweather.py # Fetch weather data from OpenWeatherMap API
│
│── src/ # Core logic of the project
│ ├── model.py # LSTM model training and prediction
│ ├── preprocess.py # Data preprocessing
│
│── templates/ # HTML templates (for Flask UI)
│ ├── index.html # Frontend UI (Optional)
│
│── static/ # Static files (CSS, JS, Images)
│
│── main.py # Flask app (Runs API & triggers training)
│── requirements.txt # Python dependencies
│── README.md # Project documentation
git clone https://github.com/OpenInitia/AI-Powered-Weather-Predictor
cd AI-Powered-Weather-Predictor
# For Windows
python -m venv venv
venv\Scripts\activate
# For Mac/Linux
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- Get your API key from OpenWeatherMap
- Create a
.env
file in the root directory:OPENWEATHER_API_KEY=your_api_key_here
python main.py
- This will:
✅ Fetch the latest weather data
✅ Train the model (if not already trained)
✅ Start the Flask server athttp://127.0.0.1:5000/
Send a POST request with JSON data:
curl -X POST http://127.0.0.1:5000/predict -H "Content-Type: application/json" -d '{"temperature": 30, "humidity": 70, "pressure": 1013}'
✅ Response Example:
{
"predicted_temperature": 31.2
}
Endpoint | Method | Description |
---|---|---|
/ |
GET | Returns the homepage (Optional UI) |
/predict |
POST | Predicts the future temperature based on inputs |
- Flask - Web framework for API development
- TensorFlow/Keras - LSTM-based machine learning model
- Scikit-learn - Data preprocessing
- NumPy & Pandas - Data handling
- Requests - Fetching weather data from OpenWeatherMap
- ✅ Add support for predicting rainfall & wind speed 🌧️
- ✅ Deploy on a cloud platform like AWS / Heroku ☁️
- ✅ Improve UI with charts 📊
Feel free to fork this project and submit a pull request!
If you find any bugs, open an issue. 🚀