File size: 2,213 Bytes
1f70be8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import gradio as gr
import papermill as pm


def run_notebook():
    try:
        # Execute the notebook
        pm.execute_notebook(
            "numero_datasets_hub.ipynb",
            "numero_datasets_hub_output.ipynb",  # This will save the output in a new notebook
        )
        return "Notebook executed successfully!"
    except Exception as e:
        return f"Failed to execute notebook: {str(e)}"


def create_app():
    with gr.Blocks() as app:

        gr.Markdown("# The language gap in the Hugging Face Hub")

        # Button to run the notebook
        run_button = gr.Button("Run Notebook")
        output_label = gr.Label()  # To display the result of running the notebook

        run_button.click(run_notebook, outputs=output_label)

        # Create a 2x2 grid for images
        with gr.Row():
            with gr.Column():
                image1 = gr.Image(
                    value="plots/datasets_hub.png",
                    label="Image 1",
                    show_label=True,
                    show_download_button=True,
                    show_share_button=True,
                )
                image2 = gr.Image(
                    value="datasets_hub.png",
                    label="Image 2",
                )
            with gr.Column():
                image3 = gr.Image(
                    value="datasets_hub.png",
                    label="Image 3",
                )
                image4 = gr.Image(
                    value="datasets_hub.png",
                    label="Image 4",
                )

        # Description for images
        gr.Markdown("### Image Descriptions")
        gr.Markdown("Description for Image 1")
        gr.Markdown("Description for Image 2")
        gr.Markdown("Description for Image 3")
        gr.Markdown("Description for Image 4")

        # Collapsible block for citation
        with gr.Accordion("Citation Information"):
            gr.Markdown(
                """
                        If you use the images or code please cite:

                        ```
                        fjdlsafd
                        ```
                        """
            )

    return app


app = create_app()
app.launch()