Update pages/home.py
Browse files- pages/home.py +83 -42
pages/home.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
import streamlit.components.v1 as components
|
3 |
from streamlit_shortcuts import button, add_keyboard_shortcuts
|
|
|
4 |
|
5 |
st.title("📘Named Entity Recognition")
|
6 |
|
@@ -12,48 +13,45 @@ st.title("📘Named Entity Recognition")
|
|
12 |
#if st.button("Scroll to End"):
|
13 |
# st.success("Reached End of page! (You can also press Ctrl+End)")
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
-
'ACTIVITY'
|
18 |
-
'ADMINISTRATION'
|
19 |
-
'AGE'
|
20 |
-
'AREA'
|
21 |
-
'BIOLOGICAL_ATTRIBUTE'
|
22 |
-
'BIOLOGICAL_STRUCTURE'
|
23 |
-
'CLINICAL_EVENT'
|
24 |
-
'COLOR'
|
25 |
-
'COREFERENCE'
|
26 |
-
'DATE'
|
27 |
-
'DETAILED_DESCRIPTION'
|
28 |
-
'DIAGNOSTIC_PROCEDURE'
|
29 |
-
'DISEASE_DISORDER'
|
30 |
-
'DISTANCE'
|
31 |
-
'DOSAGE'
|
32 |
-
'DURATION'
|
33 |
-
'FAMILY_HISTORY'
|
34 |
-
'FREQUENCY'
|
35 |
-
'HEIGHT'
|
36 |
-
'HISTORY'
|
37 |
-
'LAB_VALUE'
|
38 |
-
'MASS'
|
39 |
-
'MEDICATION'
|
40 |
-
'NONBIOLOGICAL_LOCATION'
|
41 |
-
'OCCUPATION'
|
42 |
-
'OTHER_ENTITY'
|
43 |
-
'OUTCOME'
|
44 |
-
'PERSONAL_BACKGROUND'
|
45 |
-
'QUALITATIVE_CONCEPT'
|
46 |
-
'QUANTITATIVE_CONCEPT'
|
47 |
-
'SEVERITY'
|
48 |
-
'SEX'
|
49 |
-
'SHAPE'
|
50 |
-
'SIGN_SYMPTOM'
|
51 |
-
'SUBJECT'
|
52 |
-
'TEXTURE'
|
53 |
-
'THERAPEUTIC_PROCEDURE'
|
54 |
-
'TIME'
|
55 |
-
'VOLUME'
|
56 |
-
'WEIGHT'
|
57 |
|
58 |
def scrollToBottom():
|
59 |
# JavaScript to scroll to bottom
|
@@ -124,5 +122,48 @@ def scrollToBottom():
|
|
124 |
html = f'<div style="display:none">{JS_code}</div>'
|
125 |
st.components.v1.html(html, height=0, width=0)
|
126 |
|
127 |
-
|
128 |
scrollToBottom()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
import streamlit.components.v1 as components
|
3 |
from streamlit_shortcuts import button, add_keyboard_shortcuts
|
4 |
+
import base64
|
5 |
|
6 |
st.title("📘Named Entity Recognition")
|
7 |
|
|
|
13 |
#if st.button("Scroll to End"):
|
14 |
# st.success("Reached End of page! (You can also press Ctrl+End)")
|
15 |
|
16 |
+
def auto_scroll_to_bottom():
|
17 |
+
# JavaScript to scroll to bottom
|
18 |
+
js_code = """
|
19 |
+
<script>
|
20 |
+
// Wait for the page to fully render
|
21 |
+
const scrollToBottom = () => {
|
22 |
+
// Get the main Streamlit iframe
|
23 |
+
const streamlitDoc = window.parent.document;
|
24 |
+
// Get the app container
|
25 |
+
const appContainer = streamlitDoc.querySelector('.main');
|
26 |
+
if (appContainer) {
|
27 |
+
// Scroll the app container to the bottom
|
28 |
+
appContainer.scrollTop = appContainer.scrollHeight;
|
29 |
+
} else {
|
30 |
+
// Fallback to scrolling the entire page
|
31 |
+
window.parent.scrollTo(0, streamlitDoc.body.scrollHeight);
|
32 |
+
}
|
33 |
+
};
|
34 |
+
|
35 |
+
// Try immediately
|
36 |
+
scrollToBottom();
|
37 |
+
|
38 |
+
// Also try after a short delay to ensure content is rendered
|
39 |
+
setTimeout(scrollToBottom, 200);
|
40 |
+
|
41 |
+
// And after a longer delay just to be safe
|
42 |
+
setTimeout(scrollToBottom, 500);
|
43 |
+
</script>
|
44 |
+
"""
|
45 |
+
|
46 |
+
# Render the JavaScript code
|
47 |
+
html = f'<div style="display:none">{js_code}</div>'
|
48 |
+
st.components.v1.html(html, height=0)
|
49 |
+
|
50 |
+
# Then in your button click handler, add this:
|
51 |
+
if st.button("Scroll Down"):
|
52 |
+
# Call the scroll function at the end
|
53 |
+
auto_scroll_to_bottom()
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
def scrollToBottom():
|
57 |
# JavaScript to scroll to bottom
|
|
|
122 |
html = f'<div style="display:none">{JS_code}</div>'
|
123 |
st.components.v1.html(html, height=0, width=0)
|
124 |
|
|
|
125 |
scrollToBottom()
|
126 |
+
|
127 |
+
|
128 |
+
st.header("Tags the below 41 medical entities")
|
129 |
+
|
130 |
+
'ACTIVITY'
|
131 |
+
'ADMINISTRATION'
|
132 |
+
'AGE'
|
133 |
+
'AREA'
|
134 |
+
'BIOLOGICAL_ATTRIBUTE'
|
135 |
+
'BIOLOGICAL_STRUCTURE'
|
136 |
+
'CLINICAL_EVENT'
|
137 |
+
'COLOR'
|
138 |
+
'COREFERENCE'
|
139 |
+
'DATE'
|
140 |
+
'DETAILED_DESCRIPTION'
|
141 |
+
'DIAGNOSTIC_PROCEDURE'
|
142 |
+
'DISEASE_DISORDER'
|
143 |
+
'DISTANCE'
|
144 |
+
'DOSAGE'
|
145 |
+
'DURATION'
|
146 |
+
'FAMILY_HISTORY'
|
147 |
+
'FREQUENCY'
|
148 |
+
'HEIGHT'
|
149 |
+
'HISTORY'
|
150 |
+
'LAB_VALUE'
|
151 |
+
'MASS'
|
152 |
+
'MEDICATION'
|
153 |
+
'NONBIOLOGICAL_LOCATION'
|
154 |
+
'OCCUPATION'
|
155 |
+
'OTHER_ENTITY'
|
156 |
+
'OUTCOME'
|
157 |
+
'PERSONAL_BACKGROUND'
|
158 |
+
'QUALITATIVE_CONCEPT'
|
159 |
+
'QUANTITATIVE_CONCEPT'
|
160 |
+
'SEVERITY'
|
161 |
+
'SEX'
|
162 |
+
'SHAPE'
|
163 |
+
'SIGN_SYMPTOM'
|
164 |
+
'SUBJECT'
|
165 |
+
'TEXTURE'
|
166 |
+
'THERAPEUTIC_PROCEDURE'
|
167 |
+
'TIME'
|
168 |
+
'VOLUME'
|
169 |
+
'WEIGHT'
|