File size: 1,632 Bytes
abb2e46 | 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 | import streamlit as st
import pandas as pd
import pickle
st.image(r"https://innomatics.in/wp-content/uploads/2023/01/innomatics-footer-logo.png")
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 Tumer Grade",df["Tumor_Grade"].unique())
SYMPT_SEVERITY = st.selectbox("Enter SYmptopm Severity",df["Symptoms_Severity"].unique())
FAMLIY_HISTORY = st.selectbox("Enter The Family History",df["Family_History"].unique())
SMOKING_HISTORY = st.selectbox("Enter The smoking Histoty",df["Smoking_History"].unique())
ALCOHOL_CONSUMPTION = st.selectbox("Enter The alcohol Consumption",df["Alcohol_Consumption"].unique())
EXERCISE_FREQUENCY = st.selectbox("Enter The 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_HISTORY], 'Smoking_History':[SMOKING_HISTORY], 'Alcohol_Consumption':[ALCOHOL_CONSUMPTION],
'Exercise_Frequency':[EXERCISE_FREQUENCY]})
if st.button("predict"):
result = Model.predict(input_data)
if result ==0:
st.write("Cancer is not Diognised")
else:
st.write("Cancer is Diognised") |