reshinthadith commited on
Commit
5a14023
1 Parent(s): a9a3b2f

Refactor with expander

Browse files
Files changed (1) hide show
  1. app.py +11 -10
app.py CHANGED
@@ -41,17 +41,18 @@ def load_page(split):
41
  meta = data["meta"]
42
  with st.expander("Render Content"):
43
  st.write(content)
44
- st.write("### Content:")
45
- st.text(content)
46
- st.write("### Meta:")
47
- st.write(ast.literal_eval(meta))
48
- #Tokenizer related count
49
- tokenized = tokenizer(content, return_length=True)['length'][0]
50
- token_count_metric = st.metric("Token Count(compared to 2048)",value=tokenized,delta=4096-tokenized)
 
51
  #Word related count
52
- split_words = re.findall(r'\w+', content)
53
- word_count_metric = st.metric("Word Count",value=len(split_words))
54
-
55
 
56
 
57
  demo_name = st.sidebar.selectbox("Choose a demo", splits)
 
41
  meta = data["meta"]
42
  with st.expander("Render Content"):
43
  st.write(content)
44
+ with st.expander("Raw Content"):
45
+ st.text(content)
46
+ st.write("### Meta:")
47
+ st.write(ast.literal_eval(meta))
48
+ # Tokenizer-related count
49
+ with st.expander("Metrics"):
50
+ tokenized = tokenizer(content, return_length=True)['length'][0]
51
+ token_count_metric = st.metric("Token Count(compared to 2048)",value=tokenized,delta=4096-tokenized)
52
  #Word related count
53
+ split_words = re.findall(r'\w+', content)
54
+ word_count_metric = st.metric("Word Count",value=len(split_words))
55
+
56
 
57
 
58
  demo_name = st.sidebar.selectbox("Choose a demo", splits)