Spaces:
Sleeping
Sleeping
File size: 832 Bytes
741c10e |
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 |
import streamlit as st
import pandas as pd
from utils import load_model, predict
from ui import get_user_input
def local_css(file_name):
with open(file_name) as f:
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
local_css("styles.css")
st.title("Lung Cancer Risk Predictor")
# 1. Load trained model
model = load_model('./models/model.pkl')
# 2. Collect user input as dataframe
input_df = get_user_input()
st.subheader("Patient Data")
st.write(input_df)
# 3. Make prediction
prediction, proba = predict(model, input_df)
# 4. Display results
st.subheader("Prediction")
print(prediction[0])
label = 'Cancer' if prediction[0] == 1 else 'No Cancer'
st.write(f"**{label}**")
st.subheader("Prediction Probability")
st.write(f"Probability of Cancer: {proba[0][1]:.2f}") |