Download app.py from Meenakshi9182/CancerPredictionusingML: direct link, hf CLI and curl.
- Browser
- Download file 1.63 kB
-
https://huggingface.co/spaces/Meenakshi9182/CancerPredictionusingML/resolve/main/app.py
- Command line
-
hf download hf://spaces/Meenakshi9182/CancerPredictionusingML/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Meenakshi9182/CancerPredictionusingML/resolve/main/app.py
1.63 kB
| 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") |