{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: model3d_component_events"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "with gr.Blocks() as demo:\n", " with gr.Row():\n", " with gr.Column():\n", " input_3d = gr.Model3D(label=\"Input Model3D\")\n", " with gr.Column():\n", " output_3d = gr.Model3D(label=\"Output Model3D\")\n", " with gr.Column():\n", " num_change = gr.Number(label=\"# Change Events\", value=0)\n", " num_load = gr.Number(label=\"# Upload Events\", value=0)\n", " num_clear = gr.Number(label=\"# Clear Events\", value=0)\n", " clear_value = gr.Textbox(label=\"Clear Value\", value=\"\")\n", " input_3d.upload(lambda s, n: (s, n + 1), [input_3d, num_load], [output_3d, num_load])\n", " input_3d.change(lambda n: n + 1, num_change, num_change)\n", " input_3d.clear(lambda s, n: (s, n + 1), [input_3d, num_clear], [clear_value, num_clear])\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}