Testys commited on
Commit
bdaff39
·
verified ·
1 Parent(s): 577bc04

Streamlit structure for work

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