adarsh commited on
Commit
a31a9c7
1 Parent(s): 78c1623

updated count algo

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -103,12 +103,17 @@ def main():
103
  st.markdown('<p style="text-align:center;">Made with ❤️ by <a href="https://www.adarshmaurya.onionreads.com">Adarsh Maurya</a></p>', unsafe_allow_html=True)
104
 
105
  # Add page visit count
106
- page_visits = st.session_state.get('page_visits', 0)
107
- page_visits += 1
108
- st.session_state['page_visits'] = page_visits
 
 
 
 
 
109
 
110
  # Display page visit count
111
- st.markdown(f'<p style="text-align:center;">Page Visits: {page_visits}</p>', unsafe_allow_html=True)
112
 
113
 
114
  # Run the app
 
103
  st.markdown('<p style="text-align:center;">Made with ❤️ by <a href="https://www.adarshmaurya.onionreads.com">Adarsh Maurya</a></p>', unsafe_allow_html=True)
104
 
105
  # Add page visit count
106
+ with open("assets/counter.txt", "r") as f:
107
+ pVisit = int(f.read())
108
+
109
+ pVisit += 1
110
+
111
+ with open("assets/counter.txt", "w") as f:
112
+ f.write(str(pVisit))
113
+
114
 
115
  # Display page visit count
116
+ st.markdown(f'<p style="text-align:center;">Page Visits: {pVisit}</p>', unsafe_allow_html=True)
117
 
118
 
119
  # Run the app