-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathHome.py
More file actions
39 lines (36 loc) · 1.42 KB
/
Home.py
File metadata and controls
39 lines (36 loc) · 1.42 KB
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
import streamlit as st
from streamlit.components.v1 import html
st.set_page_config(
page_title="Understanding intent",
page_icon="👋",
)
st.title("Understanding intent of articles Genre, Framings and Propagnda Techniques")
def nav_page(page_name, timeout_secs=3):
nav_script = """
<script type="text/javascript">
function attempt_nav_page(page_name, start_time, timeout_secs) {
var links = window.parent.document.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
if (links[i].href.toLowerCase().endsWith("/" + page_name.toLowerCase())) {
links[i].click();
return;
}
}
var elasped = new Date() - start_time;
if (elasped < timeout_secs * 1000) {
setTimeout(attempt_nav_page, 100, page_name, start_time, timeout_secs);
} else {
alert("Unable to navigate to page '" + page_name + "' after " + timeout_secs + " second(s).");
}
}
window.addEventListener("load", function() {
attempt_nav_page("%s", new Date(), %d);
});
</script>
""" % (page_name, timeout_secs)
html(nav_script)
c1, c2 = st.columns([6, 6])
if c1.button("Article"):
nav_page("Article")
if c2.button("Country"):
nav_page("Bar")