Sindu31's picture
Upload 4 files
01f7cc5 verified
Raw
History Blame Contribute Delete
1.64 kB
import streamlit as st
import pandas as pd
import pickle
st.image(r"https://res.cloudinary.com/graham-media-group/image/upload/f_auto/q_auto/c_scale,w_640/v1/media/gmg/3WS4NVL7MZDW3GPUCLU3WWJGTY?_a=DAJHqpE+ZAAA",width=550)
st.title("CANCER PREDICTION USING MACHINE LEARNING")
df = pd.read_csv(r'cancer_prediction_data (2).csv')
df.dropna(inplace=True)
with open(r'model.pkl','rb') as file:
model = pickle.load(file)
AGE = st.number_input("Enter the Age",min_value = 1,max_value = 100)
GENDER = st.selectbox("Enter the Gender",df['Gender'].unique())
TUMER_SIZE = st.number_input("Enter the Tumer Size")
TUMER_GRADE = st.selectbox("Enter the Tumar Grade",df["Tumor_Grade"].unique())
SYMPT_Severity = st.selectbox("Enter Symptopm Severiaty",df['Symptoms_Severity'].unique())
FAMLIY_HIST = st.selectbox('Enter the Family History',df['Family_History'].unique())
SMOKING_HIST = st.selectbox('Enter the smoking history',df['Smoking_History'].unique())
ALCOHOL = st.selectbox('Enter the Alocohol Consuption',df['Alcohol_Consumption'].unique())
EXERCISE = st.selectbox ('Enter Exercise Frequency',df['Exercise_Frequency'].unique())
Input_data = pd.DataFrame({'Age': [AGE], "Gender": [GENDER], "Tumor_Size": [TUMER_SIZE], "Tumor_Grade": [TUMER_GRADE],
"Symptoms_Severity": [SYMPT_Severity],'Family_History':[FAMLIY_HIST],"Smoking_History":[SMOKING_HIST],
"Alcohol_Consumption":[ALCOHOL],'Exercise_Frequency':[EXERCISE]})
if st.button('Predict'):
result = model.predict(Input_data)
if result == 0:
st.write('Cancer is not Diognised')
else:
st.write('Cancer is Diognised')