--- title: rainfall emoji: ๐Ÿ‘€ colorFrom: purple colorTo: red sdk: gradio sdk_version: 5.27.1 app_file: app.py pinned: false hf_oauth: true --- # Rainfall Prediction with LSTM and Gemma 2 Interpretation This application predicts daily rainfall based on weather features (temperature, humidity, and sunshine duration) using an LSTM model, and provides a natural language interpretation of the prediction using the Gemma 2-27B language model from Google via Hugging Face Inference API. --- ## ๐Ÿ“Š Features - โœ… Predicts daily **rainfall (mm)** from 3 key weather inputs. - ๐Ÿง  Uses an **LSTM neural network** trained on historical weather data. - ๐Ÿ’ฌ Generates **automatic explanation and recommendations** using **Gemma 2-27B** (`google/gemma-2-27b-it`) via Hugging Face `InferenceClient`. - ๐ŸŒ Built with **Gradio UI** for easy interaction. --- ## ๐Ÿงช Input Parameters | Parameter | Description | |---------------------------|------------------------------------------| | Average Temperature (ยฐC) | Daily mean temperature in Celsius | | Relative Humidity (%) | Average daily relative humidity | | Sunshine Duration (hours) | Total sunlight duration during the day | --- ## ๐Ÿงฎ Output - **Predicted Rainfall (mm)**: Estimated rainfall amount based on inputs. - **Interpretation**: AI-generated weather explanation using LLM (Gemma 2-27B), including suggestions for outdoor activities. --- ## ๐Ÿš€ Getting Started (for Deployment) 1. **Prepare the required files**: - `app.py` โ€” main app - `retrained_lstm_model.h5` โ€” trained LSTM model - `scaler_X.joblib`, `scaler_y.joblib` โ€” scalers used for input/output normalization 2. **Add Hugging Face token to Space secrets**: - Go to your Hugging Face Space โ†’ **Settings > Secrets** - Add a secret: - **Name**: `HF_TOKEN` - **Value**: *your Hugging Face API token* 3. **Install dependencies** using `requirements.txt`: ```txt tensorflow>=2.8.0 numpy>=1.19.5 pandas>=1.3.5 scikit-learn>=1.0.2 joblib>=1.1.0 gradio>=3.20.0 huggingface_hub>=0.18.0 Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference