File size: 2,349 Bytes
4de9c2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import streamlit as st
import pickle
from Prediction import  Prediction
from transformers import TFAutoModel



# resnet_model = pickle.load(open('models/ResNet01.pkl','rb'))
# cnn_model = pickle.load(open('models/CNNModel2.pkl','rb'))
# inc_model = pickle.load(open('models/Inception01.pkl','rb'))
resnet_model = TFAutoModel.from_pretrained("yashpat85/ResNet01")


def show_error_popup(message):
    st.error(message, icon="🚨")

st.set_page_config(layout="wide")

st.title('Kidney Disease Classification using CNN')
st.markdown('By 22DCS079 & 22DCS085')

st.header('Add Ct Scan Image')

uploaded_file = st.file_uploader("Choose a ct scan image", type=["jpg", "png", "jpeg"])

st.header("Available Models")
option = st.selectbox(
    "Available Models",
    ("ResNet", "CNN","InceptionNet"),
)

pm = Prediction()

col1, col2= st.columns(2)

if uploaded_file is not None:
    with col1:
        image_data = uploaded_file.read()
        st.image(image_data, caption="Uploaded Image")
    with col2:
        if option=="CNN":
            p = pm.predict_image(cnn_model, image_data)
        elif option=="ResNet":
            p = pm.predict_image(resnet_model, image_data)
        elif option=="InceptionNet":
            p = pm.predict_image(inc_model, image_data)
        else:
            p = "Other Models are still under training due to overfitting"

        print(p)

        if p=='Normal':
            st.markdown("""
            <style>
            .big-font {
                display: flex;
                align-items:center;
                justify-content: center;
                font-size:50px !important;
                color:green;
                height: 50vh;
            }
            </style>
            """, unsafe_allow_html=True)

            st.markdown(f'<div class="big-font">{p}</div>', unsafe_allow_html=True)
        else:
            st.markdown("""
            <style>
            .big-font {
                display: flex;
                align-items:center;
                justify-content: center;
                font-size:50px !important;
                color:red;
                height: 50vh;
            }
            </style>
            """, unsafe_allow_html=True)

            st.markdown(f'<div class="big-font">{p}</div>', unsafe_allow_html=True)
else:
    show_error_popup("Please Upload Image...")