Commit
•
6c8936b
1
Parent(s):
7cb31c4
show plots
Browse files
app.py
CHANGED
@@ -6,8 +6,8 @@ def run_notebook():
|
|
6 |
try:
|
7 |
# Execute the notebook
|
8 |
pm.execute_notebook(
|
9 |
-
"
|
10 |
-
"
|
11 |
)
|
12 |
return "Notebook executed successfully!"
|
13 |
except Exception as e:
|
@@ -17,50 +17,79 @@ def run_notebook():
|
|
17 |
def create_app():
|
18 |
with gr.Blocks() as app:
|
19 |
|
20 |
-
gr.Markdown(
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
with gr.Row():
|
29 |
with gr.Column():
|
30 |
image1 = gr.Image(
|
31 |
-
value="plots/
|
32 |
-
label="
|
33 |
show_label=True,
|
34 |
show_download_button=True,
|
35 |
show_share_button=True,
|
36 |
)
|
37 |
image2 = gr.Image(
|
38 |
-
value="
|
39 |
-
label="
|
|
|
|
|
|
|
40 |
)
|
41 |
with gr.Column():
|
42 |
image3 = gr.Image(
|
43 |
-
value="
|
44 |
-
label="
|
|
|
|
|
|
|
45 |
)
|
46 |
image4 = gr.Image(
|
47 |
-
value="
|
48 |
-
label="
|
|
|
|
|
|
|
49 |
)
|
50 |
|
51 |
-
gr.Markdown(
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
56 |
|
57 |
-
|
|
|
|
|
|
|
58 |
gr.Markdown(
|
59 |
-
"""
|
60 |
-
If you use
|
61 |
|
62 |
```
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
```
|
65 |
"""
|
66 |
)
|
|
|
6 |
try:
|
7 |
# Execute the notebook
|
8 |
pm.execute_notebook(
|
9 |
+
"hub_datasets_by_language.ipynb",
|
10 |
+
"hub_datasets_by_language_output.ipynb", # Save the output in a new notebook
|
11 |
)
|
12 |
return "Notebook executed successfully!"
|
13 |
except Exception as e:
|
|
|
17 |
def create_app():
|
18 |
with gr.Blocks() as app:
|
19 |
|
20 |
+
gr.Markdown(
|
21 |
+
"""
|
22 |
+
# Visualizing The Language Gap In The Hugging Face Hub
|
23 |
+
|
24 |
+
The open-source community is creating more a more resources in languages other than English but there is still a huge gap. This Space showcases plots that can help visualize this gap in the case of Spanish and can easily be adapted to other languages.
|
25 |
+
"""
|
26 |
+
)
|
27 |
|
28 |
+
gr.Markdown(
|
29 |
+
"""
|
30 |
+
## English vs Spanish Monolingual Datasets
|
31 |
+
|
32 |
+
Note: We consider only **monolingual** datasets in these plots, i.e. datasets that only contain data in one language. This is because *most* of the multilingual datasets are usually machine-translated and we want to focus on original data.
|
33 |
+
"""
|
34 |
+
)
|
35 |
with gr.Row():
|
36 |
with gr.Column():
|
37 |
image1 = gr.Image(
|
38 |
+
value="plots/bar_plot_horizontal.png",
|
39 |
+
label="Bar Plot Horizontal",
|
40 |
show_label=True,
|
41 |
show_download_button=True,
|
42 |
show_share_button=True,
|
43 |
)
|
44 |
image2 = gr.Image(
|
45 |
+
value="plots/bar_plot_vertical.png",
|
46 |
+
label="Bar Plot Vertical",
|
47 |
+
show_label=True,
|
48 |
+
show_download_button=True,
|
49 |
+
show_share_button=True,
|
50 |
)
|
51 |
with gr.Column():
|
52 |
image3 = gr.Image(
|
53 |
+
value="plots/stack_area.png",
|
54 |
+
label="Stack Area",
|
55 |
+
show_label=True,
|
56 |
+
show_download_button=True,
|
57 |
+
show_share_button=True,
|
58 |
)
|
59 |
image4 = gr.Image(
|
60 |
+
value="plots/time_series.png",
|
61 |
+
label="Time Series",
|
62 |
+
show_label=True,
|
63 |
+
show_download_button=True,
|
64 |
+
show_share_button=True,
|
65 |
)
|
66 |
|
67 |
+
gr.Markdown(
|
68 |
+
"""
|
69 |
+
## Adapt to other languages
|
70 |
+
|
71 |
+
This Space is WIP and more languages and visuals will be included shortly. Meanwhile, you can clone the Space, adapt the code in the notebook and run it to generate plots for other languages.
|
72 |
+
"""
|
73 |
+
)
|
74 |
+
run_button = gr.Button("Run Notebook")
|
75 |
+
output_label = gr.Label() # Display the result of running the notebook
|
76 |
|
77 |
+
run_button.click(run_notebook, outputs=output_label)
|
78 |
+
|
79 |
+
gr.Markdown("## Citation")
|
80 |
+
with gr.Accordion("Citation information", open=False):
|
81 |
gr.Markdown(
|
82 |
+
r"""
|
83 |
+
If you use these plots or the code please cite:
|
84 |
|
85 |
```
|
86 |
+
@misc{grandury2024gaphf,
|
87 |
+
author = {María Grandury},
|
88 |
+
title = {Visualizing The Language Gap In The Hugging Face Hub},
|
89 |
+
year = {2024},
|
90 |
+
publisher = {Hugging Face},
|
91 |
+
howpublished = {\url{https://huggingface.co/spaces/mariagrandury/language-gap-in-hf-hub}},
|
92 |
+
}
|
93 |
```
|
94 |
"""
|
95 |
)
|