Spaces:
Build error
Build error
Upload streamlit_apps_config.py
Browse files- streamlit_apps_config.py +141 -0
streamlit_apps_config.py
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
PRODUCTION = False
|
| 3 |
+
if PRODUCTION:
|
| 4 |
+
prepath = "/Users/vkocaman/cache_pretrained/"
|
| 5 |
+
path = "/Users/vkocaman/cache_pretrained/2.4/"
|
| 6 |
+
jar_path = "/home/ubuntu/jars/"
|
| 7 |
+
input_folder = '/home/ubuntu/streamlit/dia/resources/'
|
| 8 |
+
rules_folder = '/home/ubuntu/streamlit/dia/resources/rules/'
|
| 9 |
+
else:
|
| 10 |
+
project_path = "F:/JSL/streamlit-demo-apps/"
|
| 11 |
+
|
| 12 |
+
prepath = "file:///E://JSL/SparkNLPSUITE/models/cache_pretrained/"
|
| 13 |
+
path = "file:///E://JSL/SparkNLPSUITE/models/cache_pretrained/2.4/"
|
| 14 |
+
jar_path = "file:///E:/JSL/Jars/streamlit4/"
|
| 15 |
+
rules_folder = "file:///E://JSL/SparkNLPSUITE/streamlit-demo-apps/resources/rules/"
|
| 16 |
+
models_folder = "file:///E://JSL/SparkNLPSUITE/models/"
|
| 17 |
+
|
| 18 |
+
ENTITIES_FOR_ICD10 = ['problem', 'diagnosis', 'procedure name', 'lab name', 'symptom_name', 'procedure_name', 'procedure', 'lab_name', 'pathological_formation', 'cancer']
|
| 19 |
+
LOGO_PATH = '../resources/jsl-logo.png'
|
| 20 |
+
available_models = []
|
| 21 |
+
|
| 22 |
+
#APP STYLE
|
| 23 |
+
MAX_WIDTH = 1600
|
| 24 |
+
PADDING_TOP = 0.25
|
| 25 |
+
PADDING_BOTTOM = 0.25
|
| 26 |
+
PADDING_RIGHT = 4
|
| 27 |
+
PADDING_LEFT = 4
|
| 28 |
+
COLOR = 'black'
|
| 29 |
+
BACKGROUND_COLOR = 'white'
|
| 30 |
+
|
| 31 |
+
HTML_WRAPPER = """<div class="scroll entities" style="overflow-x: auto; border: 1px solid #e6e9ef; border-radius: 0.25rem; padding: 0.25rem; margin-bottom: 2.5rem; white-space:pre-wrap">{}</div>"""
|
| 32 |
+
HTML_INDEX_WRAPPER = """<div ">{}</div>"""
|
| 33 |
+
|
| 34 |
+
STYLE_CONFIG_OLD = f"""
|
| 35 |
+
<style>
|
| 36 |
+
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');
|
| 37 |
+
*:not(text){{
|
| 38 |
+
font-family: Montserrat;
|
| 39 |
+
}}
|
| 40 |
+
|
| 41 |
+
.reportview-container .main .block-container{{
|
| 42 |
+
max-width: {MAX_WIDTH}px;
|
| 43 |
+
padding-top: {PADDING_TOP}rem;
|
| 44 |
+
padding-right: {PADDING_RIGHT}rem;
|
| 45 |
+
padding-left: {PADDING_LEFT}rem;
|
| 46 |
+
padding-bottom: {PADDING_BOTTOM}rem;
|
| 47 |
+
}}
|
| 48 |
+
.reportview-container .main {{
|
| 49 |
+
color: {COLOR};
|
| 50 |
+
background-color: {BACKGROUND_COLOR};
|
| 51 |
+
}}
|
| 52 |
+
div.scroll {{
|
| 53 |
+
margin:1px, 1px;
|
| 54 |
+
padding:1px;
|
| 55 |
+
width: 100%;
|
| 56 |
+
height: 500px;
|
| 57 |
+
overflow-x: hidden;
|
| 58 |
+
overflow-x: auto;
|
| 59 |
+
}}
|
| 60 |
+
.entity-wrapper{{
|
| 61 |
+
padding: 1px;
|
| 62 |
+
display: inline-grid;
|
| 63 |
+
text-align:center;
|
| 64 |
+
margin-bottom:1px;
|
| 65 |
+
border-radius: 5px 5px
|
| 66 |
+
}}
|
| 67 |
+
.entity-name{{
|
| 68 |
+
background: #f1f2f3;
|
| 69 |
+
color: #3c3e44;
|
| 70 |
+
padding: 1px;
|
| 71 |
+
border-color: #484b51;
|
| 72 |
+
border-width: medium;
|
| 73 |
+
border-radius: 5px 5px;
|
| 74 |
+
}}
|
| 75 |
+
.entity-type{{
|
| 76 |
+
color: #272727;
|
| 77 |
+
text-transform: uppercase;
|
| 78 |
+
font-family: roboto;
|
| 79 |
+
font-size: 13px;
|
| 80 |
+
}}
|
| 81 |
+
.reportview-container .markdown-text-container{{
|
| 82 |
+
font-family: roboto !important;
|
| 83 |
+
color: dimgray !important;
|
| 84 |
+
line-height: normal !important;
|
| 85 |
+
}}
|
| 86 |
+
.reportview-container h2
|
| 87 |
+
{{
|
| 88 |
+
font-weight: 400 !important;
|
| 89 |
+
font-size: 1.5rem !important;
|
| 90 |
+
line-height: 1.6!important;
|
| 91 |
+
}}
|
| 92 |
+
.reportview-container h2
|
| 93 |
+
{{
|
| 94 |
+
font-weight: 300 !important;
|
| 95 |
+
font-size: 1.3rem !important;
|
| 96 |
+
line-height: 1.4!important;
|
| 97 |
+
}}
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
</style>
|
| 101 |
+
"""
|
| 102 |
+
|
| 103 |
+
with open('./utils/style.css') as f:
|
| 104 |
+
STYLE_CONFIG_NEW = f.read()
|
| 105 |
+
STYLE_CONFIG = STYLE_CONFIG_OLD + '<style>{}</style>'.format(STYLE_CONFIG_NEW)
|
| 106 |
+
|
| 107 |
+
LABEL_COLORS = {'problem':'#0C8888',
|
| 108 |
+
'test':'#FF33C1',
|
| 109 |
+
'treatment':'#3196D4',
|
| 110 |
+
'multi':'#ccfff5',
|
| 111 |
+
'multi-tissue_structure':'#8dd8b4',
|
| 112 |
+
'cell':'#ffe6cc',
|
| 113 |
+
'organism':'#ffddcc',
|
| 114 |
+
'gene_or_gene_product':'#fff0b3',
|
| 115 |
+
'organ':'#e6e600',
|
| 116 |
+
'simple_chemical':'#ffd699',
|
| 117 |
+
|
| 118 |
+
'per':'#0C8888', 'pers':'#0C8888','person':'#0C8888',
|
| 119 |
+
'org':'#FF33C1',
|
| 120 |
+
'misc': '#3196D4', 'mis': '#3196D4',
|
| 121 |
+
'loc':'#5B00A3', 'location':'#5B00A3',
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
'drug':'#33BBFF',
|
| 125 |
+
'diagnosis':'#b5a1c9',
|
| 126 |
+
'maybe':'#FFB5C5',
|
| 127 |
+
'lab_result':'#3abd80',
|
| 128 |
+
'negated':'#CD3700',
|
| 129 |
+
'name':'#C0FF3E',
|
| 130 |
+
'lab_name':'#698B22',
|
| 131 |
+
'modifier':'#8B475D',
|
| 132 |
+
'symptom_name':'#CDB7B5',
|
| 133 |
+
'section_name':'#8B7D7B',
|
| 134 |
+
'procedure_name':'#48D1CC',
|
| 135 |
+
'grading':"#8c61e8",
|
| 136 |
+
'size':"#746b87",
|
| 137 |
+
'organism_substance':'#ffaa80',
|
| 138 |
+
'gender':'#ffacb7',
|
| 139 |
+
'age':'#ffe0ac',
|
| 140 |
+
'date': '#a6b1e1'
|
| 141 |
+
}
|