rainfall_app.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import numpy as np
3
+ import joblib
4
+ from tensorflow.keras.models import load_model
5
+ import gradio as gr
6
+
7
+ # Load the saved scaler and model
8
+ scaler = joblib.load('scaler.joblib')
9
+ model = load_model('rainfall_prediction_model.h5')
10
+
11
+ def predict_rainfall(Dew_Point, Pressure, Gust_Speed, RH, Wind_Direction,
12
+ Wind_Speed, Temperature, Rained, Water_Content, Solar_Radiation):
13
+ # Preprocess the input data
14
+ input_data = np.array([[Dew_Point, Pressure, Gust_Speed, RH, Wind_Direction,
15
+ Wind_Speed, Temperature, Rained, Water_Content, Solar_Radiation]])
16
+ input_data_scaled = scaler.transform(input_data)
17
+ input_data_scaled = input_data_scaled.reshape((input_data_scaled.shape[0], 1, input_data_scaled.shape[1]))
18
+
19
+ # Make a prediction
20
+ prediction = model.predict(input_data_scaled)
21
+
22
+ # Output the prediction
23
+ return 'Rain' if prediction[0][0] > 0 else 'No Rain'
24
+
25
+ # Gradio Interface
26
+ inputs = [
27
+ gr.inputs.Number(label="Dew Point"),
28
+ gr.inputs.Number(label="Pressure"),
29
+ gr.inputs.Number(label="Gust Speed"),
30
+ gr.inputs.Number(label="Relative Humidity"),
31
+ gr.inputs.Number(label="Wind Direction"),
32
+ gr.inputs.Number(label="Wind Speed"),
33
+ gr.inputs.Number(label="Temperature"),
34
+ gr.inputs.Number(label="Rained"),
35
+ gr.inputs.Number(label="Water Content"),
36
+ gr.inputs.Number(label="Solar Radiation")
37
+ ]
38
+ output = gr.outputs.Textbox(label="Prediction")
39
+
40
+ gr.Interface(fn=predict_rainfall, inputs=inputs, outputs=output, title="Rainfall Prediction").launch()
41
+
rainfall_prediction_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cda417df87e791a82bc48abd93061cada7ddaea9cad5c7dda231431047234783
3
+ size 506208
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+
2
+ numpy
3
+ joblib
4
+ tensorflow
5
+ gradio
6
+
scaler.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dff6e925219a9a98856668c6c02016b7b68501ad95e891d408eb34cf261d1ffb
3
+ size 1319