Spaces:
Sleeping
Sleeping
File size: 2,235 Bytes
d5dc416 15707a7 d5dc416 e9885a9 15707a7 e9885a9 d5dc416 15707a7 | 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 | ---
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 |