Margerie commited on
Commit
47f7c70
1 Parent(s): 6cdc30c

Upload 3 files

Browse files
pages/1_👀_Technical_Specifications.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from persist import persist, load_widget_state
3
+ import json
4
+ import requests
5
+ #from specific_extraction import extract_it
6
+
7
+
8
+ # global variable_output
9
+
10
+
11
+
12
+ def get_cached_data():
13
+ # json.load(open('file_TG263.json'))
14
+ struct_dict = {"Target":["GTV","CTV","PTV"],"Anatomy":["SpinalCord","BrainStem"]}
15
+ r = requests.get('https://huggingface.co/api/models-tags-by-type')
16
+ tags_data = r.json()
17
+ libraries = [x['id'] for x in tags_data['library']]
18
+ return struct_dict, libraries
19
+
20
+ def main():
21
+ cs_body()
22
+
23
+
24
+
25
+ def cs_body():
26
+
27
+ struct_dict, libraries = get_cached_data()
28
+ st.header('Technical Specifications')
29
+ st.write("Provide an overview of any additional technical specifications for this model")
30
+ st.markdown('##### Model architecture')
31
+ st.number_input("Total number of trainable parameters [million]",value=5)
32
+ left, middle, right = st.columns(3)
33
+ nlines = int(left.number_input("Input channels", 0, 20, 1))
34
+ for i in range(nlines):
35
+ type_input = middle.selectbox(f"Input type # {i}", list(struct_dict.keys()))
36
+ right.selectbox("Input",struct_dict[type_input], help="From https://aapm.onlinelibrary.wiley.com/doi/pdf/10.1002/acm2.12701")
37
+ st.text_input("Loss function",placeholder="MSE")
38
+ st.number_input("Batch size",value=1)
39
+ left, right = st.columns(2)
40
+ nlines = int(left.number_input("Patch dimension", 2, 3, 3))
41
+ # cols = st.columns(ncol)
42
+ for i in range(nlines):
43
+ right.number_input(f"Dim [px] # {i}", key=i,value=128)
44
+ arch_fig = st.file_uploader("Figure of the architecture",type=['png','jpg'])
45
+ if arch_fig is not None:
46
+ st.image(arch_fig)
47
+
48
+ st.selectbox("Library/Dependencies", libraries,help="The name of the library this model came from (Ex. pytorch, timm, spacy, keras, etc.). This is usually automatically detected in model repos, so it is not required.", key=persist('library_name'))
49
+ st.text_input("Hardware recommended", placeholder="GPU 20Gb RAM", key=persist("Model_hardware"))
50
+ st.number_input("Inference time for recommended hardware [seconds]",value=10, key=persist("inference_time"))
51
+ st.text_area("Installation / Getting started", placeholder="Installation procedure / code to run inference", key=persist("Model_how_to"))
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+ if __name__ == '__main__':
60
+ load_widget_state()
61
+ main()
pages/2_🏋️‍♀️_Model_training.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ from persist import persist, load_widget_state
4
+ import numpy as np
5
+ import matplotlib.pyplot as plt
6
+ global variable_output
7
+
8
+ def main():
9
+
10
+ cs_body()
11
+
12
+ def convert_csv():
13
+ d = {'col1': [], 'col2': []}
14
+ df = pd.DataFrame(data=d, columns=['Age', 'Sex'])
15
+ return df.to_csv().encode("utf-8")
16
+
17
+ def cs_body():
18
+
19
+ st.header('Training Data and Methodology')
20
+ st.write("Provide an overview of the Training Data and Training Procedure for this model")
21
+ st.markdown('##### Training dataset')
22
+ left, right = st.columns(2)
23
+ left.number_input("Training set size",value=100)
24
+ right.number_input("Validation set size",value=20)
25
+ st.text("Demographical and clinical characteristics")
26
+ left, right = st.columns(2, vertical_alignment ="center")
27
+ left.download_button("Download Template", data=convert_csv(), file_name='file.csv')
28
+ demo = right.file_uploader("Load template",type=['csv'])
29
+ if demo is not None:
30
+ left, right = st.columns(2, vertical_alignment ="center")
31
+
32
+ fig, ax = plt.subplots()
33
+ ax.set_title("Age distribution")
34
+ ax.hist(np.random.normal(size=500))
35
+ left.pyplot(fig)
36
+
37
+ fig, ax = plt.subplots()
38
+ ax.pie([45,55],labels=["Men","Women"])
39
+ right.pyplot(fig)
40
+ st.text_input("Source",placeholder="Brats challenge/ Clinic ...")
41
+ st.text("Acquisition date")
42
+ left, right = st.columns(2)
43
+ left.date_input("From")
44
+ right.date_input("To")
45
+
46
+
47
+
48
+
49
+ if __name__ == '__main__':
50
+ load_widget_state()
51
+ main()
pages/3_🔬_Model_Evaluation.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from persist import persist, load_widget_state
3
+ from pathlib import Path
4
+
5
+ from middleMan import apply_view,writingPrompt
6
+
7
+ global variable_output
8
+
9
+ def main():
10
+ cs_body()
11
+
12
+
13
+ def cs_body():
14
+
15
+ #stateVariable = 'Model_Eval'
16
+ #help_text ='Detail the Evaluation Results for this model'
17
+ #col1.header('Model Evaluation')
18
+ st.markdown('# Evaluation')
19
+ st.text_area(" This section describes the evaluation protocols and provides the results. ",help="Detail the Evaluation Results for this model")
20
+ st.markdown('## Testing Data, Factors & Metrics:')
21
+ left, right = st.columns([2,4])
22
+
23
+ #st.markdown('### Model Description')
24
+
25
+
26
+ with left:
27
+ st.write("\n")
28
+ st.write("\n")
29
+ st.markdown('#### Testing Data:')
30
+ st.write("\n")
31
+ st.write("\n")
32
+ st.write("\n")
33
+ st.write("\n")
34
+ st.write("\n")
35
+ st.write("\n")
36
+ #st.write("\n")
37
+ st.markdown('#### Factors:')
38
+ st.write("\n")
39
+ st.write("\n")
40
+ st.write("\n")
41
+ st.write("\n")
42
+ st.write("\n")
43
+ st.write("\n")
44
+ st.markdown('#### Metrics:')
45
+ st.write("\n")
46
+ st.write("\n")
47
+ st.write("\n")
48
+ st.write("\n")
49
+ st.write("\n")
50
+ st.markdown('#### Results:')
51
+
52
+ with right:
53
+ #soutput_jinja = parse_into_jinja_markdown()
54
+ st.text_area("", help="Ideally this links to a Dataset Card.",key=persist("Testing_Data"))
55
+ #st.write("\n")
56
+ st.text_area("",help="What are the foreseeable characteristics that will influence how the model behaves? This includes domain and context, as well as population subgroups.",key=persist("Factors"))
57
+ st.text_area("", help="What metrics will be used for evaluation in light of tradeoffs between different errors?", key=persist("Metrics"))
58
+ st.text_area("", key=persist("Model_Results"))
59
+
60
+
61
+
62
+
63
+
64
+ if __name__ == '__main__':
65
+ load_widget_state()
66
+ main()