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) 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", ) 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") with gr.Accordion("Citation Information"): gr.Markdown( """ If you use the images or code please cite: ``` fjdlsafd ``` """ ) return app app = create_app() app.launch()