import streamlit as st import joblib import numpy as np # Load the trained model model = joblib.load("random_forest_model.joblib") # Title st.title("πŸ€– AI Model Predictor") inputs = [] feature_names = ['Baseline Fetal Heart Rate','Number of accelerations per second', 'Number of fetal movements per second', 'Number of uterine contractions per second', 'Number of LDs per second', 'Number of SDs per second', 'Number of PDs per second'] for i in feature_names: value = st.text_input(f"{i}", value=0.0) inputs.append(value) # Converting and reshaping inputs to a NumPy array input_array = np.array([inputs]).reshape(1, -1) # Prediction Button if st.button("πŸ” Predict"): prediction = model.predict(input_array)[0] if prediction == 1 : status = 'Normal' elif prediction == 2: status = 'Suspect' else: status = 'Pathological' st.success(f"πŸ€– Model Prediction: **{prediction:.2f}**") st.success(f"πŸ‘ΌπŸΌ Prediction Class: **{status}**")