Mpavan45 commited on
Commit
b72f7be
·
verified ·
1 Parent(s): b61fdf3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -6,10 +6,13 @@ st.title("NLP Theory Blog")
6
  # Sidebar for navigation
7
  st.sidebar.title("Navigation")
8
  pages = ["Introduction to NLP", "NLP Techniques"]
9
- page = st.sidebar.radio("Go to:", pages)
 
 
 
10
 
11
  # Content for each page
12
- if page == "Introduction to NLP":
13
  st.header("What is Natural Language Processing (NLP)?")
14
  st.write("""
15
  Natural Language Processing (NLP) is a field of Artificial Intelligence that focuses on the interaction between computers and humans through natural language.
@@ -24,7 +27,7 @@ if page == "Introduction to NLP":
24
  NLP combines computational linguistics with machine learning and deep learning techniques to process language.
25
  """)
26
 
27
- elif page == "NLP Techniques":
28
  st.header("Common NLP Techniques")
29
  st.write("""
30
  NLP involves several techniques for processing and analyzing text and speech data. Here are some key techniques:
@@ -47,14 +50,13 @@ with col1:
47
  if st.button("Previous Page"):
48
  if current_page == "NLP Techniques":
49
  st.experimental_set_query_params(page=pages[0])
50
- st.experimental_rerun() # Forces the app to rerun
51
 
52
  with col2:
53
  if st.button("Next Page"):
54
  if current_page == "Introduction to NLP":
55
  st.experimental_set_query_params(page=pages[1])
56
- st.experimental_rerun() # Forces the app to rerun
57
-
58
 
59
  # Footer
60
  st.sidebar.write("---")
 
6
  # Sidebar for navigation
7
  st.sidebar.title("Navigation")
8
  pages = ["Introduction to NLP", "NLP Techniques"]
9
+
10
+ # Handle query params to set the active page
11
+ query_params = st.experimental_get_query_params()
12
+ current_page = query_params.get("page", ["Introduction to NLP"])[0]
13
 
14
  # Content for each page
15
+ if current_page == "Introduction to NLP":
16
  st.header("What is Natural Language Processing (NLP)?")
17
  st.write("""
18
  Natural Language Processing (NLP) is a field of Artificial Intelligence that focuses on the interaction between computers and humans through natural language.
 
27
  NLP combines computational linguistics with machine learning and deep learning techniques to process language.
28
  """)
29
 
30
+ elif current_page == "NLP Techniques":
31
  st.header("Common NLP Techniques")
32
  st.write("""
33
  NLP involves several techniques for processing and analyzing text and speech data. Here are some key techniques:
 
50
  if st.button("Previous Page"):
51
  if current_page == "NLP Techniques":
52
  st.experimental_set_query_params(page=pages[0])
53
+ st.experimental_rerun()
54
 
55
  with col2:
56
  if st.button("Next Page"):
57
  if current_page == "Introduction to NLP":
58
  st.experimental_set_query_params(page=pages[1])
59
+ st.experimental_rerun()
 
60
 
61
  # Footer
62
  st.sidebar.write("---")