# 🌍 Disaster Prediction Model This repository contains a deep learning model for **disaster classification** from images, capable of identifying six disaster-related categories including fire, water damage, infrastructure damage, and more. The model is built using **ResNet50** and trained for image classification tasks. ## 🧠 Model Details - **Architecture**: ResNet50 - **Trained On**: Kaggle Disaster Dataset - **Image Size**: 256x256 - **Input**: RGB image - **Output**: Disaster category - **License**: MIT - **Pipeline Tag**: `image-classification` - **Main Metric**: Accuracy ## 📦 Installation & Cloning ```bash # Install Git LFS (if not already installed) git lfs install # Clone the repository git clone https://huggingface.co/Luwayy/disaster-prediction ``` ## 🔍 Classes The model predicts one of the following disaster categories: | ID | Class Name | |----|-------------------------| | 0 | Damaged_Infrastructure | | 1 | Fire_Disaster | | 2 | Human_Damage | | 3 | Land_Disaster | | 4 | Non_Damage | | 5 | Water_Disaster | ## 📸 Example Usage (Python) ```python import keras import numpy as np from PIL import Image import requests from io import BytesIO # Load the model model = keras.layers.TFSMLayer( "disaster-prediction/kaggle/working/disaster_model", call_endpoint="serving_default" ) # Load and preprocess image url = 'https://www.spml.co.in/Images/blog/wdt&c-152776632.jpg' response = requests.get(url) img = Image.open(BytesIO(response.content)).convert("RGB").resize((256, 256)) img_array = np.array(img) / 255.0 img_array = np.expand_dims(img_array, axis=0).astype(np.float32) # Predict output = model(img_array) preds = list(output.values())[0].numpy() pred_index = np.argmax(preds) # Class labels labels = [ "Damaged_Infrastructure", "Fire_Disaster", "Human_Damage", "Land_Disaster", "Non_Damage", "Water_Disaster" ] print("Predicted class:", labels[pred_index]) ``` ## ⚙️ Preprocessing - **Resize**: (256, 256) - **Scale**: Normalize pixel values by dividing by 255