Spaces:
No application file
No application file
Create Project SEAS
Browse files- Project SEAS +39 -0
Project SEAS
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import numpy as np
|
| 3 |
+
|
| 4 |
+
def predict(temp, humidity, wind, soundAbove, soundBelow, ph, turbidity, waterTemp):
|
| 5 |
+
"""
|
| 6 |
+
Basic water quality risk prediction model.
|
| 7 |
+
- High Risk: pH < 6 OR Turbidity > 50 NTU
|
| 8 |
+
- Medium Risk: Water Temp > 30°C OR Sound Above > 70dB
|
| 9 |
+
- Low Risk: Otherwise
|
| 10 |
+
"""
|
| 11 |
+
if ph < 6 or turbidity > 50:
|
| 12 |
+
risk = "⚠️ High Risk (Poor Water Quality)"
|
| 13 |
+
elif waterTemp > 30 or soundAbove > 70:
|
| 14 |
+
risk = "⚠️ Medium Risk (Possible Issues)"
|
| 15 |
+
else:
|
| 16 |
+
risk = "✅ Low Risk (Good Water Quality)"
|
| 17 |
+
|
| 18 |
+
return risk
|
| 19 |
+
|
| 20 |
+
# Create a Gradio interface
|
| 21 |
+
interface = gr.Interface(
|
| 22 |
+
fn=predict,
|
| 23 |
+
inputs=[
|
| 24 |
+
gr.Number(label="Ambient Temperature (°C)"),
|
| 25 |
+
gr.Number(label="Humidity (%)"),
|
| 26 |
+
gr.Number(label="Wind Speed (m/s)"),
|
| 27 |
+
gr.Number(label="Sound Above Water (dB)"),
|
| 28 |
+
gr.Number(label="Sound Below Water (dB)"),
|
| 29 |
+
gr.Number(label="pH Level"),
|
| 30 |
+
gr.Number(label="Turbidity (NTU)"),
|
| 31 |
+
gr.Number(label="Water Temperature (°C)")
|
| 32 |
+
],
|
| 33 |
+
outputs="text",
|
| 34 |
+
title="Project SEAS Water Quality ML Model",
|
| 35 |
+
description="Predicts water quality risks based on sensor data."
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
# Launch the model
|
| 39 |
+
interface.launch()
|