paddle12 commited on
Commit
98927ed
·
verified ·
1 Parent(s): 7a77788

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -47,20 +47,21 @@ def predict_fault(uploaded_csv):
47
 
48
  # Merge fault descriptions
49
  df['Predicted Fault Type'] = predicted_faults
50
- df = df.merge(fault_table, left_on='Predicted Fault Type', right_on='Fault Type', how='left')
51
-
52
- # Plot bar chart of fault type counts
53
  fig, ax = plt.subplots()
54
  fault_counts = df['Predicted Fault Type'].value_counts().sort_index()
55
  fault_counts.plot(kind='bar', ax=ax)
56
  ax.set_title("Jumlah Tipe Fault yang Diprediksi")
57
- ax.set_xlabel("Fault Type")
58
- ax.set_ylabel("Count")
59
  ax.set_xticks(range(4))
60
  ax.set_xticklabels(["No Fault", "Rich", "Lean", "Low Volt"], rotation=0)
61
  plt.tight_layout()
62
-
63
- return df[['Predicted Fault Type', 'Fault Name', 'Conditions']].head(10), fig
 
64
 
65
  # Gradio Interface
66
  demo = gr.Interface(
 
47
 
48
  # Merge fault descriptions
49
  df['Predicted Fault Type'] = predicted_faults
50
+ df = df.merge(fault_table, left_on='Predicted Fault Type', right_on='Tipe Kerusakan', how='left')
51
+
52
+ # Plot bar chart
53
  fig, ax = plt.subplots()
54
  fault_counts = df['Predicted Fault Type'].value_counts().sort_index()
55
  fault_counts.plot(kind='bar', ax=ax)
56
  ax.set_title("Jumlah Tipe Fault yang Diprediksi")
57
+ ax.set_xlabel("Tipe Fault")
58
+ ax.set_ylabel("Jumlah")
59
  ax.set_xticks(range(4))
60
  ax.set_xticklabels(["No Fault", "Rich", "Lean", "Low Volt"], rotation=0)
61
  plt.tight_layout()
62
+
63
+ # Return output
64
+ return df[['Predicted Fault Type', 'Nama Kerusakan', 'Kondisi']].head(10), fig
65
 
66
  # Gradio Interface
67
  demo = gr.Interface(