|
|
import streamlit as st |
|
|
import joblib |
|
|
import numpy as np |
|
|
|
|
|
|
|
|
model = joblib.load("random_forest_model.joblib") |
|
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
|
input_array = np.array([inputs]).reshape(1, -1) |
|
|
|
|
|
|
|
|
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}**") |
|
|
|