Puree's picture
Update app.py
60a5b26
# -*- coding: utf-8 -*-
"""app.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1oAFb0lQ60MTeHdmQvqQwgEtMQzg7f0t4
"""
import joblib
import pandas as pd
import streamlit as st
model = joblib.load('model.joblib')
def main():
st.title("Brain stroke predict")
with st.form("questionaire"):
age = st.slider("Age",min_value=10, max_value=100)
avg_glucose_level = st.slider("Average glucose level",min_value=40, max_value=300)
bmi = st.slider("BMI(Body mass index )",min_value=12, max_value=50)
# clicked==True only when the button is clicked
clicked = st.form_submit_button("Predict")
if clicked:
result=model.predict(pd.DataFrame({"age": [age],
"avg_glucose_level": [avg_glucose_level],
"bmi": [bmi]}))
# Show prediction
if result[0] == 1:
st.success("You have change of getting brain stroke")
else:
st.success("You haven't change of getting brain stroke")
if __name__ == '__main__':
main()
# Run main()