dhruvsaxena11 commited on
Commit
ac21da3
·
verified ·
1 Parent(s): b0d7f76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
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 = f"Recommendations based on analysis:\n\n1. {'; '.join(anomalies)}\n\n2. {damage_output}"
 
 
 
 
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: