mariagrandury commited on
Commit
6c8936b
1 Parent(s): 7cb31c4

show plots

Browse files
Files changed (1) hide show
  1. app.py +55 -26
app.py CHANGED
@@ -6,8 +6,8 @@ def run_notebook():
6
  try:
7
  # Execute the notebook
8
  pm.execute_notebook(
9
- "numero_datasets_hub.ipynb",
10
- "numero_datasets_hub_output.ipynb", # This will save the output in a new notebook
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("# The language gap in the Hugging Face Hub")
21
-
22
- # Button to run the notebook
23
- run_button = gr.Button("Run Notebook")
24
- output_label = gr.Label() # To display the result of running the notebook
25
-
26
- run_button.click(run_notebook, outputs=output_label)
27
 
 
 
 
 
 
 
 
28
  with gr.Row():
29
  with gr.Column():
30
  image1 = gr.Image(
31
- value="plots/datasets_hub.png",
32
- label="Image 1",
33
  show_label=True,
34
  show_download_button=True,
35
  show_share_button=True,
36
  )
37
  image2 = gr.Image(
38
- value="datasets_hub.png",
39
- label="Image 2",
 
 
 
40
  )
41
  with gr.Column():
42
  image3 = gr.Image(
43
- value="datasets_hub.png",
44
- label="Image 3",
 
 
 
45
  )
46
  image4 = gr.Image(
47
- value="datasets_hub.png",
48
- label="Image 4",
 
 
 
49
  )
50
 
51
- gr.Markdown("### Image Descriptions")
52
- gr.Markdown("Description for Image 1")
53
- gr.Markdown("Description for Image 2")
54
- gr.Markdown("Description for Image 3")
55
- gr.Markdown("Description for Image 4")
 
 
 
 
56
 
57
- with gr.Accordion("Citation Information"):
 
 
 
58
  gr.Markdown(
59
- """
60
- If you use the images or code please cite:
61
 
62
  ```
63
- fjdlsafd
 
 
 
 
 
 
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
  )