Spaces:
Sleeping
Sleeping
Commit
·
4f9f819
1
Parent(s):
d02038d
Update app.py
Browse files
app.py
CHANGED
@@ -17,12 +17,18 @@ with st.echo():
|
|
17 |
eng_num_tokens = dataset.map(lambda x: {'num_tokens':len(tokenizer(x['sentence_eng_Latn'])['input_ids'])})['num_tokens']
|
18 |
ukr_num_tokens = dataset.map(lambda x: {'num_tokens':len(tokenizer(x['sentence_ukr_Cyrl'])['input_ids'])})['num_tokens']
|
19 |
|
20 |
-
|
21 |
-
axl.
|
22 |
-
axl.
|
23 |
-
|
24 |
-
axr.
|
25 |
-
|
|
|
|
|
|
|
26 |
|
27 |
-
|
|
|
|
|
|
|
28 |
|
|
|
17 |
eng_num_tokens = dataset.map(lambda x: {'num_tokens':len(tokenizer(x['sentence_eng_Latn'])['input_ids'])})['num_tokens']
|
18 |
ukr_num_tokens = dataset.map(lambda x: {'num_tokens':len(tokenizer(x['sentence_ukr_Cyrl'])['input_ids'])})['num_tokens']
|
19 |
|
20 |
+
with st.sidebar:
|
21 |
+
fig, (axl, axr) = plt.subplots(2, 1, figsize=(3,10))
|
22 |
+
axl.hist(eng_num_tokens)
|
23 |
+
axl.set_title(f'eng mistral tokens ({np.sum(eng_num_tokens)} total)')
|
24 |
+
axr.hist(ukr_num_tokens)
|
25 |
+
axr.set_title(f'ukr mistral tokens ({np.sum(ukr_num_tokens)} total)')
|
26 |
+
st.pyplot(fig)
|
27 |
+
|
28 |
+
keyword = st.text_input("Filter by text", value="")
|
29 |
|
30 |
+
if not keyword:
|
31 |
+
st.dataframe(pd.DataFrame(dataset))
|
32 |
+
else:
|
33 |
+
st.dataframe(pd.DataFrame(dataset.filter(lambda x: keyword in x['sentence_eng_Latn'] or keyword in x['sentence_ukr_Cyrl'])))
|
34 |
|