Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,7 @@ st.set_page_config(
|
|
| 16 |
initial_sidebar_state="expanded"
|
| 17 |
)
|
| 18 |
|
| 19 |
-
# ================= CUSTOM CSS
|
| 20 |
st.markdown("""
|
| 21 |
<style>
|
| 22 |
/* ================= ROOT & COLORS ================= */
|
|
@@ -455,25 +455,29 @@ with col2:
|
|
| 455 |
)
|
| 456 |
)
|
| 457 |
st.plotly_chart(fig2, use_container_width=True)
|
| 458 |
-
# Insight 1
|
| 459 |
-
# Analisis data untuk menentukan pola
|
| 460 |
front_pressure_avg = dff[dff['Position'].isin([1, 2])]['Pressure (psi)'].mean()
|
| 461 |
rear_pressure_avg = dff[dff['Position'].isin([3, 4])]['Pressure (psi)'].mean()
|
| 462 |
front_temp_avg = dff[dff['Position'].isin([1, 2])]['Temperature (°C)'].mean()
|
| 463 |
rear_temp_avg = dff[dff['Position'].isin([3, 4])]['Temperature (°C)'].mean()
|
| 464 |
|
|
|
|
|
|
|
| 465 |
if front_pressure_avg < rear_pressure_avg and front_temp_avg > rear_temp_avg:
|
| 466 |
insight_text = f"""
|
| 467 |
-
Front tyres (Pos 1 & 2):
|
| 468 |
"""
|
|
|
|
| 469 |
elif front_pressure_avg > rear_pressure_avg and front_temp_avg < rear_temp_avg:
|
| 470 |
insight_text = f"""
|
| 471 |
-
Front tyres
|
| 472 |
"""
|
|
|
|
| 473 |
else:
|
| 474 |
insight_text = f"""
|
| 475 |
-
Front tyres: Pressure {front_pressure_avg:.1f} psi, temperature {front_temp_avg:.1f}°C. Rear tyres: Pressure {rear_pressure_avg:.1f} psi, temperature {rear_temp_avg:.1f}°C.
|
| 476 |
"""
|
|
|
|
| 477 |
st.markdown(f"""
|
| 478 |
<div class="insight-box">
|
| 479 |
<div class="content">
|
|
@@ -662,7 +666,7 @@ else:
|
|
| 662 |
insight_lines.append(f"Front tyres (Pos 1 & 2) account for {front_pct:.1f}% of all alarms, indicating higher stress or usage intensity upfront.")
|
| 663 |
if top_zone != "N/A":
|
| 664 |
insight_lines.append(f"Zone {top_zone} records the highest alarm frequency across all positions.")
|
| 665 |
-
insight_lines.append("
|
| 666 |
|
| 667 |
insight_text = "\n".join(insight_lines)
|
| 668 |
|
|
|
|
| 16 |
initial_sidebar_state="expanded"
|
| 17 |
)
|
| 18 |
|
| 19 |
+
# ================= CUSTOM CSS
|
| 20 |
st.markdown("""
|
| 21 |
<style>
|
| 22 |
/* ================= ROOT & COLORS ================= */
|
|
|
|
| 455 |
)
|
| 456 |
)
|
| 457 |
st.plotly_chart(fig2, use_container_width=True)
|
| 458 |
+
# Insight 1 — Fisika & Mekanikal
|
|
|
|
| 459 |
front_pressure_avg = dff[dff['Position'].isin([1, 2])]['Pressure (psi)'].mean()
|
| 460 |
rear_pressure_avg = dff[dff['Position'].isin([3, 4])]['Pressure (psi)'].mean()
|
| 461 |
front_temp_avg = dff[dff['Position'].isin([1, 2])]['Temperature (°C)'].mean()
|
| 462 |
rear_temp_avg = dff[dff['Position'].isin([3, 4])]['Temperature (°C)'].mean()
|
| 463 |
|
| 464 |
+
# Fisika: Tekanan rendah → deformasi besar → hysteresis → panas lebih banyak
|
| 465 |
+
# Mekanikal: Ban depan tanggung beban pengereman & kemudi → stres lebih tinggi
|
| 466 |
if front_pressure_avg < rear_pressure_avg and front_temp_avg > rear_temp_avg:
|
| 467 |
insight_text = f"""
|
| 468 |
+
Front tyres (Pos 1 & 2): Lower pressure ({front_pressure_avg:.1f} psi) causes higher deformation causes hysteresis increased and elevated temperature ({front_temp_avg:.1f}°C). Rear tyres (Pos 3 & 4): Higher pressure ({rear_pressure_avg:.1f} psi) reduces deformation and make lower heat generation ({rear_temp_avg:.1f}°C), more stable under static load.
|
| 469 |
"""
|
| 470 |
+
|
| 471 |
elif front_pressure_avg > rear_pressure_avg and front_temp_avg < rear_temp_avg:
|
| 472 |
insight_text = f"""
|
| 473 |
+
Front tyres: Higher pressure ({front_pressure_avg:.1f} psi) reduces deformation, lower heat ({front_temp_avg:.1f}°C), less mechanical stress. Rear tyres: Lower pressure ({rear_pressure_avg:.1f} psi) increases deformation, higher heat ({rear_temp_avg:.1f}°C) potential overloading or misalignment.
|
| 474 |
"""
|
| 475 |
+
|
| 476 |
else:
|
| 477 |
insight_text = f"""
|
| 478 |
+
Front tyres: Pressure {front_pressure_avg:.1f} psi, temperature {front_temp_avg:.1f}°C → stable under current load/pressure balance. Rear tyres: Pressure {rear_pressure_avg:.1f} psi, temperature {rear_temp_avg:.1f}°C → balanced operation.
|
| 479 |
"""
|
| 480 |
+
|
| 481 |
st.markdown(f"""
|
| 482 |
<div class="insight-box">
|
| 483 |
<div class="content">
|
|
|
|
| 666 |
insight_lines.append(f"Front tyres (Pos 1 & 2) account for {front_pct:.1f}% of all alarms, indicating higher stress or usage intensity upfront.")
|
| 667 |
if top_zone != "N/A":
|
| 668 |
insight_lines.append(f"Zone {top_zone} records the highest alarm frequency across all positions.")
|
| 669 |
+
insight_lines.append("Alarm clustering in specific hours and front positions suggests opportunity for targeted inspection scheduling.")
|
| 670 |
|
| 671 |
insight_text = "\n".join(insight_lines)
|
| 672 |
|