Mpavan45 commited on
Commit
455b6dd
·
verified ·
1 Parent(s): c66eb9c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -18
app.py CHANGED
@@ -6,13 +6,10 @@ st.title("NLP Theory Blog")
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,7 +24,7 @@ if current_page == "Introduction to NLP":
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:
@@ -45,18 +42,13 @@ elif current_page == "NLP Techniques":
45
  """)
46
 
47
  # Pagination buttons
48
- col1, col2 = st.columns(2)
49
- with col1:
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() # Forces the app to 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() # Forces the app to rerun
60
 
61
  # Footer
62
  st.sidebar.write("---")
 
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
  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:
 
42
  """)
43
 
44
  # Pagination buttons
45
+ if st.button("Previous Page"):
46
+ if page == "NLP Techniques":
47
+ st.experimental_set_query_params(page=pages[0])
48
+
49
+ if st.button("Next Page"):
50
+ if page == "Introduction to NLP":
51
+ st.experimental_set_query_params(page=pages[1])
 
 
 
 
 
52
 
53
  # Footer
54
  st.sidebar.write("---")