taskswithcode commited on
Commit
1b9fec9
1 Parent(s): 6ad0c29

view count

Browse files
Files changed (2) hide show
  1. app.py +20 -0
  2. view_count.txt +1 -0
app.py CHANGED
@@ -157,6 +157,25 @@ example_file_names = {
157
  "Customer feedback mixed with noise (50+ sentences)":"larger_test.txt"
158
  }
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
 
161
  def construct_model_info_for_display():
162
  options_arr = []
@@ -271,6 +290,7 @@ def init_session():
271
  def main():
272
  init_session()
273
  st.markdown("<h5 style='text-align: center;'>Compare popular/state-of-the-art models for Sentence Similarity task</h5>", unsafe_allow_html=True)
 
274
 
275
 
276
  try:
 
157
  "Customer feedback mixed with noise (50+ sentences)":"larger_test.txt"
158
  }
159
 
160
+ view_count_file = "view_count.txt"
161
+
162
+ def get_views():
163
+ ret_val = 0
164
+ if ("view_count" not in st.session_state):
165
+ try:
166
+ data = int(open(view_count_file).read().strip("\n"))
167
+ except:
168
+ data = 0
169
+ data += 1
170
+ ret_val = data
171
+ st.session_state["view_count"] = data
172
+ with open(view_count_file,"w") as fp:
173
+ fp.write(str(data))
174
+ else:
175
+ ret_val = st.session_state["view_count"]
176
+ return "{:,}".format(ret_val)
177
+
178
+
179
 
180
  def construct_model_info_for_display():
181
  options_arr = []
 
290
  def main():
291
  init_session()
292
  st.markdown("<h5 style='text-align: center;'>Compare popular/state-of-the-art models for Sentence Similarity task</h5>", unsafe_allow_html=True)
293
+ st.markdown(f"<div style='color: #9f9f9f; text-align: right'>views:&nbsp;{get_views()}</div>", unsafe_allow_html=True)
294
 
295
 
296
  try:
view_count.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ 453