Spaces:
Sleeping
Sleeping
Update Fault_Classification.py
Browse files- Fault_Classification.py +4 -4
Fault_Classification.py
CHANGED
|
@@ -10,7 +10,7 @@ import pickle
|
|
| 10 |
import matplotlib.pyplot as plt
|
| 11 |
|
| 12 |
# Streamlit app setup
|
| 13 |
-
st.title("Dynamic Fault Detection
|
| 14 |
|
| 15 |
# Sidebar for configuration
|
| 16 |
st.sidebar.title("Configuration")
|
|
@@ -60,7 +60,7 @@ if datasets:
|
|
| 60 |
|
| 61 |
if st.sidebar.button("Train Model"):
|
| 62 |
with st.spinner("Training in progress..."):
|
| 63 |
-
history = model.fit(X_train_scaled, y_train, epochs=st.sidebar.slider("Epochs",
|
| 64 |
st.success("Model trained successfully!")
|
| 65 |
model.save("trained_model.h5")
|
| 66 |
st.write("### Training History")
|
|
@@ -77,7 +77,7 @@ if datasets:
|
|
| 77 |
# Prediction Section
|
| 78 |
st.header("Make Predictions")
|
| 79 |
feature_names = X.columns.tolist() if datasets else []
|
| 80 |
-
input_data = [st.number_input(f"Enter value for {feature}", step=0.
|
| 81 |
|
| 82 |
if st.button("Predict Fault Type"):
|
| 83 |
loaded_model = load_model("trained_model.h5")
|
|
@@ -88,7 +88,7 @@ if st.button("Predict Fault Type"):
|
|
| 88 |
st.success(f"The predicted fault class is: {predicted_class}")
|
| 89 |
|
| 90 |
# Plot the entered data as a line graph
|
| 91 |
-
plt.figure(figsize=(10,
|
| 92 |
plt.plot(feature_names, input_data, marker='o')
|
| 93 |
plt.title("Input Data Points")
|
| 94 |
plt.xlabel("Features")
|
|
|
|
| 10 |
import matplotlib.pyplot as plt
|
| 11 |
|
| 12 |
# Streamlit app setup
|
| 13 |
+
st.title("Dynamic Fault Detection using Deep Learning")
|
| 14 |
|
| 15 |
# Sidebar for configuration
|
| 16 |
st.sidebar.title("Configuration")
|
|
|
|
| 60 |
|
| 61 |
if st.sidebar.button("Train Model"):
|
| 62 |
with st.spinner("Training in progress..."):
|
| 63 |
+
history = model.fit(X_train_scaled, y_train, epochs=st.sidebar.slider("Epochs", 50, 100, 10), batch_size=st.sidebar.slider("Batch Size", 16, 128, 32), validation_split=0.2)
|
| 64 |
st.success("Model trained successfully!")
|
| 65 |
model.save("trained_model.h5")
|
| 66 |
st.write("### Training History")
|
|
|
|
| 77 |
# Prediction Section
|
| 78 |
st.header("Make Predictions")
|
| 79 |
feature_names = X.columns.tolist() if datasets else []
|
| 80 |
+
input_data = [st.number_input(f"Enter value for {feature}", step=0.0000001) for feature in feature_names]
|
| 81 |
|
| 82 |
if st.button("Predict Fault Type"):
|
| 83 |
loaded_model = load_model("trained_model.h5")
|
|
|
|
| 88 |
st.success(f"The predicted fault class is: {predicted_class}")
|
| 89 |
|
| 90 |
# Plot the entered data as a line graph
|
| 91 |
+
plt.figure(figsize=(10, 2))
|
| 92 |
plt.plot(feature_names, input_data, marker='o')
|
| 93 |
plt.title("Input Data Points")
|
| 94 |
plt.xlabel("Features")
|