StrokeLineAI / app.py
DeepActionPotential's picture
Upload folder using huggingface_hub
da0d126 verified
raw
history blame contribute delete
864 Bytes
import streamlit as st
import joblib
from utils import preprocess_input, predict_stroke
from ui import input_form, display_result
@st.cache_resource
def load_model(path: str = "./models/model.pkl"):
"""Load the trained classifier from disk."""
return joblib.load(path)
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")
def main():
st.title("Stroke Prediction Demo")
st.write("Enter patient metrics to predict stroke risk/type.")
# Get raw numeric inputs
data = input_form()
# Preprocess and predict
model = load_model()
X = preprocess_input(data)
label, proba = predict_stroke(model, X)
# Show result
display_result(label, proba)
if __name__ == "__main__":
main()