File size: 1,015 Bytes
bdaff39 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import streamlit as st
import pandas as pd
import numpy as np
import pickle
# Load the saved model
with open('rf_model.pkl', 'rb') as file:
rf_model = pickle.load(file)
# Create the Streamlit app
st.title("Parkinson's Disease Prediction")
# Collect user input
col = ['MDVP:Fo(Hz)', 'MDVP:Fhi(Hz)', 'MDVP:Flo(Hz)', 'MDVP:Jitter(%)',
'MDVP:Jitter(Abs)', 'MDVP:RAP', 'MDVP:PPQ', 'Jitter:DDP',
'MDVP:Shimmer', 'MDVP:Shimmer(dB)', 'Shimmer:APQ3', 'Shimmer:APQ5',
'MDVP:APQ', 'Shimmer:DDA', 'NHR', 'HNR', 'RPDE', 'DFA',
'spread1', 'spread2', 'D2', 'PPE']
input_data = {}
for feature in col:
input_data[feature] = st.number_input(f"Enter {feature}", value=0.0)
# Make the prediction
if st.button("Predict"):
input_array = np.array(list(input_data.values())).reshape(1, -1)
prediction = rf_model.predict(input_array)
# Display the results
if prediction[0] == 1:
st.error("Parkinson's Disease detected")
else:
st.success("No Parkinson's Disease") |