AzizWazir commited on
Commit
71a27aa
·
verified ·
1 Parent(s): 78bf771

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -1,14 +1,11 @@
1
  import gradio as gr
2
  import numpy as np
3
- import pandas as pd
4
  import matplotlib.pyplot as plt
5
- from sklearn.linear_model import LinearRegression
6
- from sklearn.preprocessing import MinMaxScaler
7
  import joblib
8
 
9
  # Load the pre-trained model and scaler
10
- model = joblib.load("water_quality_model.pkl") # Ensure the model file is in the same directory
11
- scaler = joblib.load("scaler.pkl")
12
 
13
  # Define water quality categories
14
  def classify_quality(score):
@@ -26,7 +23,7 @@ def predict_water_quality(pH, turbidity, dissolved_oxygen, nitrate_levels):
26
  # Prepare the input data
27
  data = np.array([[pH, turbidity, dissolved_oxygen, nitrate_levels]])
28
  scaled_data = scaler.transform(data)
29
-
30
  # Predict the quality score
31
  score = model.predict(scaled_data)[0]
32
  quality = classify_quality(score)
 
1
  import gradio as gr
2
  import numpy as np
 
3
  import matplotlib.pyplot as plt
 
 
4
  import joblib
5
 
6
  # Load the pre-trained model and scaler
7
+ model = joblib.load("water_quality_model.pkl") # Ensure the model file exists
8
+ scaler = joblib.load("scaler.pkl") # Ensure the scaler file exists
9
 
10
  # Define water quality categories
11
  def classify_quality(score):
 
23
  # Prepare the input data
24
  data = np.array([[pH, turbidity, dissolved_oxygen, nitrate_levels]])
25
  scaled_data = scaler.transform(data)
26
+
27
  # Predict the quality score
28
  score = model.predict(scaled_data)[0]
29
  quality = classify_quality(score)