Spaces:
Sleeping

File size: 2,988 Bytes
47953a5
4d0445c
47953a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4d0445c
 
 
 
 
 
47953a5
4d0445c
 
 
 
 
 
47953a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# -*- coding: utf-8 -*-
"""app.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1UOyd50n4MSLjUw-9hS-slbMyEFJXwUGN
"""

import joblib
import pandas as pd
import streamlit as st

model = joblib.load('model.joblib')
unique_values = joblib.load('unique_values.joblib')

unique_GENDER =  unique_values["GENDER"]

def main():
    st.title("LUNG_CANCER Analysis YES=2 , NO=1")

    with st.form("questionaire"):
        age = st.slider("AGE", min_value=10, max_value=100)
        gender = st.selectbox("GENDER", unique_GENDER)
        smoking = st.slider("SMOKING", min_value=1, max_value=2)
        yellow_fingers = st.slider("YELLOW_FINGERS", min_value=1, max_value=2)
        anxiety = st.slider("ANXIETY", min_value=1, max_value=2)
        peer_pressure = st.slider("PEER_PRESSURE", min_value=1, max_value=2)
        chronic_diseaes = st.slider("CHRONIC DISEASE", min_value=1, max_value=2)
        fatigue = st.slider("FATIGUE", min_value=1, max_value=2)
        allergy = st.slider("ALLERGY", min_value=1, max_value=2)
        wheezing = st.slider("WHEEZING", min_value=1, max_value=2)
        algohol_consuming = st.slider("ALCOHOL CONSUMING", min_value=1, max_value=2)
        coughing = st.slider("COUGHING", min_value=1, max_value=2)
        shortness_of_breath = st.slider("SHORTNESS OF BREATH", min_value=1, max_value=2)
        swallowing_difficulty = st.slider("SWALLOWING DIFFICULTY", min_value=1, max_value=2)
        chest_pain = st.slider("CHEST PAIN", min_value=1, max_value=2)

        clicked = st.form_submit_button("Predict lung cancer")
        if clicked:
            result=model.predict(pd.DataFrame({"AGE": [age],
                                               "GENDER": [gender],
                                               "SMOKING": [smoking],
                                               "YELLOW_FINGERS": [yellow_fingers],
                                               "ANXIETY": [anxiety],
                                               "PEER_PRESSURE": [peer_pressure],
                                               "CHRONIC DISEASE": [chronic_diseaes],
                                               "FATIGUE": [fatigue],
                                               "ALLERGY": [allergy],
                                               "WHEEZING": [wheezing],
                                               "ALCOHOL CONSUMING": [algohol_consuming],
                                               "COUGHING": [coughing],
                                               "SHORTNESS OF BREATH": [shortness_of_breath],
                                               "SWALLOWING DIFFICULTY": [swallowing_difficulty],
                                               "CHEST PAIN": [chest_pain]}))
            result = 'เป็น' if result[0] == 1 else 'ไม่เป็น'
            st.success('The predicted lung cancer is {}'.format(result))

if __name__=='__main__':
    main()