Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -80,16 +80,20 @@ def analyze_data(image, df):
|
|
80 |
thresholds = {"engine_temp": 100, "oil_pressure": 25, "tire_pressure": 28, "battery_voltage": 11.5}
|
81 |
|
82 |
if any(df["engine_temp"] > thresholds["engine_temp"]):
|
83 |
-
anomalies.append("Engine temperature is above normal.")
|
84 |
if any(df["oil_pressure"] < thresholds["oil_pressure"]):
|
85 |
-
anomalies.append("Oil pressure is below normal.")
|
86 |
if any(df["tire_pressure"] < thresholds["tire_pressure"]):
|
87 |
-
anomalies.append("Tire pressure is below normal.")
|
88 |
if any(df["battery_voltage"] < thresholds["battery_voltage"]):
|
89 |
-
anomalies.append("Battery voltage is below normal.")
|
90 |
|
91 |
# Recommendations
|
92 |
-
recommendations =
|
|
|
|
|
|
|
|
|
93 |
return recommendations, plot_sensor_data(df)
|
94 |
|
95 |
except Exception as e:
|
|
|
80 |
thresholds = {"engine_temp": 100, "oil_pressure": 25, "tire_pressure": 28, "battery_voltage": 11.5}
|
81 |
|
82 |
if any(df["engine_temp"] > thresholds["engine_temp"]):
|
83 |
+
anomalies.append("Engine temperature is above normal detected.")
|
84 |
if any(df["oil_pressure"] < thresholds["oil_pressure"]):
|
85 |
+
anomalies.append("Oil pressure is below normal detected.")
|
86 |
if any(df["tire_pressure"] < thresholds["tire_pressure"]):
|
87 |
+
anomalies.append("Tire pressure is below normal detected.")
|
88 |
if any(df["battery_voltage"] < thresholds["battery_voltage"]):
|
89 |
+
anomalies.append("Battery voltage is below normal detected.")
|
90 |
|
91 |
# Recommendations
|
92 |
+
recommendations = "Analysis:\n\n"
|
93 |
+
recommendations += "\n".join([f"- {anomaly}" for anomaly in anomalies]) + "\n\n"
|
94 |
+
recommendations += f"Damage Analysis:\n- {damage_output}\n\n"
|
95 |
+
recommendations += "Recommendations:\n\n- Please make repairs at a nearby service station for optimal car performance."
|
96 |
+
|
97 |
return recommendations, plot_sensor_data(df)
|
98 |
|
99 |
except Exception as e:
|