import streamlit as st import pandas as pd import pickle st.image(r"http://innomatics.in/wp-content/uploads/2023/01/innomatics-footer-logo.png") st.title("Caners prediction using Machine learning") df=pd.read_csv(r'cancer_prediction_data (2).csv') df.dropna(inplace=True) with open('model.pkl','rb') as file: model=pickle.load(file) # AGE = st.number_input( # "Enter Age", # min_value=1, # max_value=100, # step=1 # ) # GENDER = st.selectbox( # "Select Gender", # df["Gender"].unique() # ) # TUMOR_SIZE = st.number_input( # "Enter Tumor Size", # min_value=0.0 # ) # TUMOR_GRADE = st.selectbox( # "Select Tumor Grade", # df["Tumor_Grade"].unique() # ) # SYMPTOM_SEVERITY = st.selectbox( # "Select Symptom Severity", # df["Symptoms_Severity"].unique() # ) # FAMILY_HISTORY = st.selectbox( # "Family History", # df["Family_History"].unique() # ) # SMOKING_HISTORY = st.selectbox( # "Smoking History", # df["Smoking_History"].unique() # ) # ALCOHOL_CONSUMPTION = st.selectbox( # "Alcohol Consumption", # df["Alcohol_Consumption"].unique() # ) # EXERCISE_FREQUENCY = st.selectbox( # "Exercise Frequency", # df["Exercise_Frequency"].unique() # ) # input_data = pd.DataFrame([{ # "Age": AGE, # "Gender": GENDER, # "Tumor_Size": TUMOR_SIZE, # "Tumor_Grade": TUMOR_GRADE, # "Symptoms_Severity": SYMPTOM_SEVERITY, # "Family_History": FAMILY_HISTORY, # "Smoking_History": SMOKING_HISTORY, # "Alcohol_Consumption": ALCOHOL_CONSUMPTION, # "Exercise_Frequency": EXERCISE_FREQUENCY # }]) 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 SYmptomp Severity", df['Symptoms_Severity'].unique()) FAMILY_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 Consumption', 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": FAMILY_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 not diognised")