dvilasuero HF staff commited on
Commit
b41a0ac
1 Parent(s): 3c986cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -1,7 +1,8 @@
1
  import streamlit as st
2
  import os
3
  from datasets import load_dataset
4
-
 
5
 
6
  HF_TOKEN = os.environ.get("HF_TOKEN")
7
 
@@ -11,5 +12,21 @@ df = ds.to_pandas()
11
 
12
  st.title("MMLU Translations Progress")
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  st.dataframe(df)
15
 
 
1
  import streamlit as st
2
  import os
3
  from datasets import load_dataset
4
+ import pandas as pd
5
+ import matplotlib.pyplot as plt
6
 
7
  HF_TOKEN = os.environ.get("HF_TOKEN")
8
 
 
12
 
13
  st.title("MMLU Translations Progress")
14
 
15
+ # Extract the language from the metadata column and create a new column
16
+ df['language'] = df['metadata'].apply(lambda x: x.get('language'))
17
+
18
+ # Count the occurrences of each language
19
+ language_counts = df['language'].value_counts()
20
+
21
+ # Plotting the bar chart using matplotlib
22
+ fig, ax = plt.subplots()
23
+ language_counts.plot(kind='bar', ax=ax)
24
+ ax.set_title('Number of Rows for Each Language')
25
+ ax.set_xlabel('Language')
26
+ ax.set_ylabel('Count')
27
+
28
+ # Display the plot in the Streamlit app
29
+ st.pyplot(fig)
30
+
31
  st.dataframe(df)
32