-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
44 lines (31 loc) · 1.17 KB
/
main.py
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
34
35
36
37
38
39
40
41
42
43
import streamlit as st
import pandas as pd
from util import Util
import time, random
st.set_page_config(
page_title="Liver Disease Prediction",
)
util = Util(file_path='G:\liver-disease-detection-main\data\Dataset.csv')
st.header("LIVER DISEASE PREDICTION APPLICATION")
# Create a text element and let the reader know the data is loading.
data_load_state = st.info('Loading data...')
# Load rows of data
patient_data = util.get_data()
X_train, X_test, y_train, y_test = util.split_data(patient_data)
#train model
data_load_state.info("Training the model..")
model = util.build_model(X_train, y_train)
# Notify the reader that the data was successfully loaded.
data_load_state.info('Application is ready for predictions.')
## FORM for Prediction
st.subheader("Fill in your patient data here for diagnosis")
with st.sidebar:
st.subheader("Try other values")
randomize = st.button("Generate test patient values")
if randomize:
data_list = util.sample_data(patient_data)
idx = random.randint(0, len(data_list))
input_vals = data_list[idx]
st.json(input_vals)
util.form_functions(model)
st.markdown(util.page_footer(),unsafe_allow_html=True)