Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import joblib | |
| import numpy as np | |
| with open('src/forest_fire_model', 'rb') as file: | |
| model = joblib.load(file) | |
| with open('src/forest_fire_scaler', 'rb') as file: | |
| scaler = joblib.load(file) | |
| with open('src/forest_fire_encoder', 'rb') as file: | |
| encoder = joblib.load(file) | |
| st.title('Forest Fire Prediction :fire:') | |
| Temperature =st.slider("Temperature : ", 22, 42, step=1) | |
| RH = st.number_input("Relative Humidity : ", 21, 90, step=1) | |
| Rain = st.number_input("Rain(mm) : ", 0.0, 16.80, step=1.0) | |
| FFMC = st.number_input("Fine Fuel Moisture Code : ",28.6, 96.0, step=1.0) | |
| DMC = st.number_input("Duff Moisture Code : ",0.7, 65.9, step=1.0) | |
| DC = st.number_input("DC",6.9, 220.4, step=1.0) | |
| ISI = st.number_input("ISI", 0.0, 100.0, step=1.0) | |
| BUI = st.number_input("BUI", 0.0, 100.0, step=1.0) | |
| FWI = st.number_input("FWI", 0.0, 100.0, step=1.0) | |
| if st.button("Submit"): | |
| model_input = np.array([[Temperature, RH, Rain, FFMC, DMC, DC, ISI, BUI, FWI]]) | |
| model_input = scaler.transform(model_input) | |
| output = model.predict(model_input) | |
| output = encoder.inverse_transform(output) | |
| rephrased = ["forest fire" if output[0]=='fire' else "no forest fire"] | |
| st.write(f"There will be {rephrased[0]} in the next 24 hours") |