-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
68 lines (58 loc) · 2.16 KB
/
app.py
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
import streamlit as st
import pandas as pd
import plotly.express as px
if __name__ == "__main__":
st.title('Model Results')
input_tab, view_tab = st.tabs(["Input", "Plots"])
if "rows" not in st.session_state:
st.session_state.rows = []
with input_tab.form(key='results'):
name = st.text_input(label='Model Name', key='name')
notes = st.text_input(label='Model Description')
recall = st.number_input('Recall', min_value=0., max_value=1., step=0.001)
precision = st.number_input('Precision', min_value=0., max_value=1., step=0.001)
f1 = st.number_input('F1 Score', min_value=0., max_value=1., step=0.001)
cm = st.file_uploader('Confusion Matrix')
submit_button = st.form_submit_button(label='Submit')
if submit_button:
st.session_state.rows.append({
'name': name,
'notes': notes,
'recall': recall,
'precision': precision,
'f1': f1,
'Recall': recall,
'Precision': precision,
'F1': f1,
'cm': cm
})
st.session_state.df = pd.DataFrame(st.session_state.rows)
if len(st.session_state.df) > 0:
view_tab.dataframe(
st.session_state.df[['name', 'notes', 'F1', 'Precision', 'Recall']].style.highlight_max(
axis=0, subset=['F1', 'Precision', 'Recall']
)
)
view_tab.plotly_chart(
px.strip(
st.session_state.df,
y=['f1', 'precision', 'recall'],
color='name',
hover_data={
'name': True,
'variable': False,
'value': False,
'F1': True,
'Precision': True,
'Recall': True
},
range_y=[-0.1, 1.1]
)
)
cm_select = view_tab.selectbox(
'Model Version',
options=st.session_state.df.index,
format_func=lambda choice: st.session_state.rows[choice]['name']
)
im_data = st.session_state.rows[cm_select]['cm']
view_tab.image(im_data)